[Edit] Don't wrap non-editable objects

In Edit mode, don't bother wrapping domain objects which should
not be edited even in principle. Avoids insulating these objects
from updates which occur asynchronously, which in turn avoids
WTD-1291.
This commit is contained in:
Victor Woeltjen
2015-06-17 10:16:59 -07:00
parent f6eb9904ff
commit 0ae1ba4a40
3 changed files with 38 additions and 11 deletions

View File

@ -31,7 +31,7 @@ define(
mockQ,
mockNavigationService,
mockObject,
mockCapability,
mockType,
controller;
beforeEach(function () {
@ -48,15 +48,18 @@ define(
"domainObject",
[ "getId", "getModel", "getCapability", "hasCapability" ]
);
mockCapability = jasmine.createSpyObj(
"capability",
[ "invoke" ]
mockType = jasmine.createSpyObj(
"type",
[ "hasFeature" ]
);
mockNavigationService.getNavigation.andReturn(mockObject);
mockObject.getId.andReturn("test");
mockObject.getModel.andReturn({ name: "Test object" });
mockObject.getCapability.andReturn(mockCapability);
mockObject.getCapability.andCallFake(function (key) {
return key === 'type' && mockType;
});
mockType.hasFeature.andReturn(true);
controller = new EditController(
mockScope,
@ -76,7 +79,7 @@ define(
.toBeDefined();
// Shouldn't have been the mock capability we provided
expect(controller.navigatedObject().getCapability("editor"))
.not.toEqual(mockCapability);
.not.toEqual(mockType);
});
it("detaches its navigation listener when destroyed", function () {
@ -119,4 +122,4 @@ define(
});
}
);
);