[Edit] Update failing specs
Update failing specs after changes to insulate root in Edit mode for WTD-922.
This commit is contained in:
@@ -19,18 +19,22 @@ define(
|
|||||||
// methods for domain objects, so give it an
|
// methods for domain objects, so give it an
|
||||||
// arbitrary interface to wrap.
|
// arbitrary interface to wrap.
|
||||||
mockContext =
|
mockContext =
|
||||||
jasmine.createSpyObj("context", [ "getDomainObject" ]);
|
jasmine.createSpyObj("context", [ "getDomainObject", "getRoot" ]);
|
||||||
mockTestObject = jasmine.createSpyObj(
|
mockTestObject = jasmine.createSpyObj(
|
||||||
"domainObject",
|
"domainObject",
|
||||||
[ "getId", "getModel", "getCapability" ]
|
[ "getId", "getModel", "getCapability" ]
|
||||||
);
|
);
|
||||||
mockFactory =
|
mockFactory = jasmine.createSpyObj(
|
||||||
jasmine.createSpyObj("factory", ["getEditableObject"]);
|
"factory",
|
||||||
|
["getEditableObject", "isRoot"]
|
||||||
|
);
|
||||||
|
|
||||||
someValue = { x: 42 };
|
someValue = { x: 42 };
|
||||||
|
|
||||||
|
mockContext.getRoot.andReturn(mockTestObject);
|
||||||
mockContext.getDomainObject.andReturn(mockTestObject);
|
mockContext.getDomainObject.andReturn(mockTestObject);
|
||||||
mockFactory.getEditableObject.andReturn(someValue);
|
mockFactory.getEditableObject.andReturn(someValue);
|
||||||
|
mockFactory.isRoot.andReturn(true);
|
||||||
|
|
||||||
capability = new EditableContextCapability(
|
capability = new EditableContextCapability(
|
||||||
mockContext,
|
mockContext,
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ define(
|
|||||||
);
|
);
|
||||||
mockContext = jasmine.createSpyObj(
|
mockContext = jasmine.createSpyObj(
|
||||||
'context',
|
'context',
|
||||||
[ 'getRoot' ]
|
[ 'getTrueRoot' ]
|
||||||
);
|
);
|
||||||
|
|
||||||
mockDomainObject.getId.andReturn('test-id');
|
mockDomainObject.getId.andReturn('test-id');
|
||||||
mockDomainObject.getCapability.andReturn(mockContext);
|
mockDomainObject.getCapability.andReturn(mockContext);
|
||||||
|
|
||||||
// Return a new instance of the root object each time
|
// Return a new instance of the root object each time
|
||||||
mockContext.getRoot.andCallFake(function () {
|
mockContext.getTrueRoot.andCallFake(function () {
|
||||||
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
||||||
mockRoot.getId.andReturn('root-id');
|
mockRoot.getId.andReturn('root-id');
|
||||||
return mockRoot;
|
return mockRoot;
|
||||||
@@ -75,7 +75,7 @@ define(
|
|||||||
firstRoot = controller.getRoot();
|
firstRoot = controller.getRoot();
|
||||||
|
|
||||||
// Change the exposed root
|
// Change the exposed root
|
||||||
mockContext.getRoot.andCallFake(function () {
|
mockContext.getTrueRoot.andCallFake(function () {
|
||||||
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
||||||
mockRoot.getId.andReturn('other-root-id');
|
mockRoot.getId.andReturn('other-root-id');
|
||||||
return mockRoot;
|
return mockRoot;
|
||||||
|
|||||||
Reference in New Issue
Block a user