[Actions] Update specs

Update specs for actions which change domain objects to
reflect their restriction to types that are creatable,
WTD-723.
This commit is contained in:
Victor Woeltjen
2015-01-27 13:09:23 -08:00
parent 4c42d4de28
commit aa9ceeb2be
4 changed files with 26 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ define(
mockNavigationService,
mockLog,
mockDomainObject,
mockType,
actionContext,
action;
@@ -30,6 +31,13 @@ define(
"domainObject",
[ "getId", "getModel", "getCapability" ]
);
mockType = jasmine.createSpyObj(
"type",
[ "hasFeature" ]
);
mockDomainObject.getCapability.andReturn(mockType);
mockType.hasFeature.andReturn(true);
actionContext = { domainObject: mockDomainObject };
@@ -44,6 +52,8 @@ define(
it("is only applicable when a domain object is present", function () {
expect(EditAction.appliesTo(actionContext)).toBeTruthy();
expect(EditAction.appliesTo({})).toBeFalsy();
// Should have checked for creatability
expect(mockType.hasFeature).toHaveBeenCalledWith('creation');
});
it("changes URL path to edit mode when performed", function () {