mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 21:53:08 +00:00
[Edit] Update specs
Update spec for editable persistence capability to include delegation of refreshes, which supports revision-checking when exiting edit mode. WTD-1033.
This commit is contained in:
parent
267053b431
commit
27af3a6b88
@ -15,7 +15,7 @@ define(
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockPersistence = jasmine.createSpyObj(
|
mockPersistence = jasmine.createSpyObj(
|
||||||
"persistence",
|
"persistence",
|
||||||
[ "persist" ]
|
[ "persist", "refresh" ]
|
||||||
);
|
);
|
||||||
mockEditableObject = jasmine.createSpyObj(
|
mockEditableObject = jasmine.createSpyObj(
|
||||||
"editableObject",
|
"editableObject",
|
||||||
@ -30,6 +30,8 @@ define(
|
|||||||
[ "markDirty" ]
|
[ "markDirty" ]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
mockDomainObject.getCapability.andReturn(mockPersistence);
|
||||||
|
|
||||||
capability = new EditablePersistenceCapability(
|
capability = new EditablePersistenceCapability(
|
||||||
mockPersistence,
|
mockPersistence,
|
||||||
mockEditableObject,
|
mockEditableObject,
|
||||||
@ -49,6 +51,18 @@ define(
|
|||||||
expect(mockPersistence.persist).not.toHaveBeenCalled();
|
expect(mockPersistence.persist).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("refreshes using the original domain object's persistence", function () {
|
||||||
|
// Refreshing needs to delegate via the unwrapped domain object.
|
||||||
|
// Otherwise, only the editable version of the object will be updated;
|
||||||
|
// we instead want the real version of the object to receive these
|
||||||
|
// changes.
|
||||||
|
expect(mockDomainObject.getCapability).not.toHaveBeenCalled();
|
||||||
|
expect(mockPersistence.refresh).not.toHaveBeenCalled();
|
||||||
|
capability.refresh();
|
||||||
|
expect(mockDomainObject.getCapability).toHaveBeenCalledWith('persistence');
|
||||||
|
expect(mockPersistence.refresh).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
Loading…
Reference in New Issue
Block a user