[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) { function (EditorCapability) {
"use strict"; "use strict";
describe("An editable context capability", function () { describe("The editor capability", function () {
var mockPersistence, var mockPersistence,
mockEditableObject, mockEditableObject,
mockDomainObject, mockDomainObject,
@ -32,6 +32,8 @@ define(
); );
mockCallback = jasmine.createSpy("callback"); mockCallback = jasmine.createSpy("callback");
mockDomainObject.getCapability.andReturn(mockPersistence);
model = { someKey: "some value", x: 42 }; model = { someKey: "some value", x: 42 };
capability = new EditorCapability( capability = new EditorCapability(
@ -42,8 +44,8 @@ define(
); );
}); });
it("mutates the real domain object on save", function () { it("mutates the real domain object on nonrecursive save", function () {
capability.save().then(mockCallback); capability.save(true).then(mockCallback);
// Wait for promise to resolve // Wait for promise to resolve
waitsFor(function () { 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 () { it("tells the cache to save others", function () {
capability.save().then(mockCallback); capability.save().then(mockCallback);

View File

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

View File

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