mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 01:42:31 +00:00
Merge remote-tracking branch 'origin/open705' into open-master
This commit is contained in:
commit
7be872c3a4
@ -16,6 +16,7 @@
|
||||
"name": "Sine Wave Generator",
|
||||
"glyph": "T",
|
||||
"description": "A sine wave generator",
|
||||
"features": "creation",
|
||||
"model": {
|
||||
"telemetry": {
|
||||
"period": 10
|
||||
|
@ -45,7 +45,9 @@ define(
|
||||
}
|
||||
|
||||
// Introduce one create action per type
|
||||
return typeService.listTypes().map(function (type) {
|
||||
return typeService.listTypes().filter(function (type) {
|
||||
return type.hasFeature("creation");
|
||||
}).map(function (type) {
|
||||
return new CreateAction(
|
||||
type,
|
||||
destination,
|
||||
|
@ -12,6 +12,7 @@ define(
|
||||
var mockTypeService,
|
||||
mockDialogService,
|
||||
mockCreationService,
|
||||
mockTypes,
|
||||
provider;
|
||||
|
||||
function createMockType(name) {
|
||||
@ -23,9 +24,11 @@ define(
|
||||
"getName",
|
||||
"getDescription",
|
||||
"getProperties",
|
||||
"getInitialModel"
|
||||
"getInitialModel",
|
||||
"hasFeature"
|
||||
]
|
||||
);
|
||||
mockType.hasFeature.andReturn(true);
|
||||
mockType.getName.andReturn(name);
|
||||
return mockType;
|
||||
}
|
||||
@ -43,10 +46,9 @@ define(
|
||||
"creationService",
|
||||
[ "createObject" ]
|
||||
);
|
||||
mockTypes = [ "A", "B", "C" ].map(createMockType);
|
||||
|
||||
mockTypeService.listTypes.andReturn(
|
||||
[ "A", "B", "C" ].map(createMockType)
|
||||
);
|
||||
mockTypeService.listTypes.andReturn(mockTypes);
|
||||
|
||||
provider = new CreateActionProvider(
|
||||
mockTypeService,
|
||||
@ -68,6 +70,19 @@ define(
|
||||
domainObject: {}
|
||||
}).length).toEqual(0);
|
||||
});
|
||||
|
||||
it("does not expose non-creatable types", function () {
|
||||
// One of the types won't have the creation feature...
|
||||
mockTypes[1].hasFeature.andReturn(false);
|
||||
// ...so it should have been filtered out.
|
||||
expect(provider.getActions({
|
||||
key: "create",
|
||||
domainObject: {}
|
||||
}).length).toEqual(2);
|
||||
// Make sure it was creation which was used to check
|
||||
expect(mockTypes[1].hasFeature)
|
||||
.toHaveBeenCalledWith("creation");
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user