[Edit] Update failing specs

Update failing specs in Edit mode with changes made for revision
checking, WTD-1033.
This commit is contained in:
Victor Woeltjen 2015-03-24 16:31:14 -07:00
parent 5867f8ad98
commit 35371f89ab
3 changed files with 12 additions and 18 deletions

View File

@ -5,7 +5,7 @@ define(
function (EditorCapability) {
"use strict";
describe("An editable context capability", function () {
describe("The editor capability", function () {
var mockPersistence,
mockEditableObject,
mockDomainObject,
@ -32,6 +32,8 @@ define(
);
mockCallback = jasmine.createSpy("callback");
mockDomainObject.getCapability.andReturn(mockPersistence);
model = { someKey: "some value", x: 42 };
capability = new EditorCapability(
@ -42,8 +44,8 @@ define(
);
});
it("mutates the real domain object on save", function () {
capability.save().then(mockCallback);
it("mutates the real domain object on nonrecursive save", function () {
capability.save(true).then(mockCallback);
// Wait for promise to resolve
waitsFor(function () {
@ -60,19 +62,6 @@ define(
});
});
it("marks the saved object as clean in the editing cache", function () {
capability.save().then(mockCallback);
// Wait for promise to resolve
waitsFor(function () {
return mockCallback.calls.length > 0;
}, 250);
runs(function () {
expect(mockCache.markClean).toHaveBeenCalledWith(mockEditableObject);
});
});
it("tells the cache to save others", function () {
capability.save().then(mockCallback);

View File

@ -7,6 +7,7 @@ define(
describe("The Edit mode controller", function () {
var mockScope,
mockQ,
mockNavigationService,
mockObject,
mockCapability,
@ -17,6 +18,7 @@ define(
"$scope",
[ "$on" ]
);
mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
mockNavigationService = jasmine.createSpyObj(
"navigationService",
[ "getNavigation", "addListener", "removeListener" ]
@ -37,6 +39,7 @@ define(
controller = new EditController(
mockScope,
mockQ,
mockNavigationService
);
});

View File

@ -1,4 +1,4 @@
/*global define,describe,it,expect,beforeEach*/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../../src/objects/EditableDomainObjectCache"],
@ -10,6 +10,7 @@ define(
var captured,
completionCapability,
object,
mockQ,
cache;
@ -33,6 +34,7 @@ define(
}
beforeEach(function () {
mockQ = jasmine.createSpyObj('$q', ['when', 'all']);
captured = {};
completionCapability = {
save: function () {
@ -40,7 +42,7 @@ define(
}
};
cache = new EditableDomainObjectCache(WrapObject);
cache = new EditableDomainObjectCache(WrapObject, mockQ);
});
it("wraps objects using provided constructor", function () {