mirror of
https://github.com/nasa/openmct.git
synced 2025-06-11 20:01:41 +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:
@ -42,8 +42,12 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function RootModelProvider(roots, $q, $log) {
|
function RootModelProvider(roots, $q, $log) {
|
||||||
// Pull out identifiers to used as ROOT's
|
// Pull out identifiers to used as ROOT's, while setting locations.
|
||||||
var ids = roots.map(function (root) { return root.id; }),
|
var ids = roots.map(function (root) {
|
||||||
|
if (!root.model) root.model = {};
|
||||||
|
root.model.location = 'ROOT';
|
||||||
|
return root.id;
|
||||||
|
}),
|
||||||
baseProvider = new StaticModelProvider(roots, $q, $log);
|
baseProvider = new StaticModelProvider(roots, $q, $log);
|
||||||
|
|
||||||
function addRoot(models) {
|
function addRoot(models) {
|
||||||
|
@ -79,6 +79,12 @@ define(
|
|||||||
expect(captured.b.someProperty).toEqual("Some Value B");
|
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 () {
|
it("does not provide models which are not in extension declarations", function () {
|
||||||
provider.getModels(["c"]).then(capture);
|
provider.getModels(["c"]).then(capture);
|
||||||
|
Reference in New Issue
Block a user