[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:
Victor Woeltjen
2015-11-09 16:28:04 -08:00
parent 066fd55590
commit 2866574dc0
5 changed files with 50 additions and 14 deletions

View File

@@ -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 () {