[Actions] Define applicability
Define applicability of Move/Copy/Link using appliesTo, to avoid errors being thrown due to lack of context during instantiation. Addresses immediate cause of nasa/openmctweb#120.
This commit is contained in:
@@ -94,6 +94,28 @@ define(
|
||||
composeService = new MockCopyService();
|
||||
});
|
||||
|
||||
it("are only applicable to domain objects with a context", function () {
|
||||
var noContextObject = domainObjectFactory({
|
||||
name: 'selectedObject',
|
||||
model: { name: 'selectedObject' },
|
||||
capabilities: {}
|
||||
});
|
||||
|
||||
expect(AbstractComposeAction.appliesTo({
|
||||
selectedObject: selectedObject
|
||||
})).toBe(true);
|
||||
expect(AbstractComposeAction.appliesTo({
|
||||
domainObject: selectedObject
|
||||
})).toBe(true);
|
||||
|
||||
expect(AbstractComposeAction.appliesTo({
|
||||
selectedObject: noContextObject
|
||||
})).toBe(false);
|
||||
expect(AbstractComposeAction.appliesTo({
|
||||
domainObject: noContextObject
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
describe("with context from context-action", function () {
|
||||
beforeEach(function () {
|
||||
|
||||
Reference in New Issue
Block a user