mirror of
https://github.com/nasa/openmct.git
synced 2025-02-20 17:33:23 +00:00
[Root] Root model provider sets location
Root model provider sets the location of roods so that the location capability does not need special handling for this.
This commit is contained in:
parent
94854e5965
commit
5c74365f4b
@ -42,8 +42,12 @@ define(
|
||||
* @constructor
|
||||
*/
|
||||
function RootModelProvider(roots, $q, $log) {
|
||||
// Pull out identifiers to used as ROOT's
|
||||
var ids = roots.map(function (root) { return root.id; }),
|
||||
// Pull out identifiers to used as ROOT's, while setting locations.
|
||||
var ids = roots.map(function (root) {
|
||||
if (!root.model) root.model = {};
|
||||
root.model.location = 'ROOT';
|
||||
return root.id;
|
||||
}),
|
||||
baseProvider = new StaticModelProvider(roots, $q, $log);
|
||||
|
||||
function addRoot(models) {
|
||||
@ -77,4 +81,4 @@ define(
|
||||
|
||||
return RootModelProvider;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
@ -79,6 +79,12 @@ define(
|
||||
expect(captured.b.someProperty).toEqual("Some Value B");
|
||||
});
|
||||
|
||||
it("provides models with a location", function () {
|
||||
provider.getModels(["a", "b"]).then(capture);
|
||||
expect(captured.a.location).toBe('ROOT');
|
||||
expect(captured.b.location).toBe('ROOT');
|
||||
});
|
||||
|
||||
|
||||
it("does not provide models which are not in extension declarations", function () {
|
||||
provider.getModels(["c"]).then(capture);
|
||||
@ -96,4 +102,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user