[Edit Mode] #627 removed edit concerns from browse controllers and markup

Fixed elements not appearing in edit mode

Fixed failing tests
This commit is contained in:
Henry
2016-02-26 17:12:35 -08:00
parent a910fa8f37
commit 2cc2c6a9d3
11 changed files with 140 additions and 73 deletions

View File

@@ -33,8 +33,8 @@ define(
testRepresentation,
mockDomainObject,
mockPersistence,
mockCapabilities,
mockStatusCapability,
mockCapabilities,
representer;
function mockPromise(value) {
@@ -48,7 +48,7 @@ define(
beforeEach(function () {
mockQ = { when: mockPromise };
mockLog = jasmine.createSpyObj("$log", ["info", "debug"]);
mockScope = jasmine.createSpyObj("$scope", ["$watch"]);
mockScope = jasmine.createSpyObj("$scope", ["$watch", "$on"]);
testRepresentation = { key: "test" };
mockDomainObject = jasmine.createSpyObj("domainObject", [
"getId",
@@ -60,7 +60,7 @@ define(
mockPersistence =
jasmine.createSpyObj("persistence", ["persist"]);
mockStatusCapability =
jasmine.createSpyObj("status", ["get"]);
jasmine.createSpyObj("statusCapability", ["get", "listen"]);
mockStatusCapability.get.andReturn(false);
mockCapabilities = {
'persistence': mockPersistence,
@@ -82,6 +82,17 @@ define(
expect(mockScope.commit).toEqual(jasmine.any(Function));
});
it("Sets edit view template on edit mode", function () {
mockStatusCapability.listen.mostRecentCall.args[0](['editing']);
expect(mockScope.viewObjectTemplate).toEqual('edit-object');
});
it("Cleans up listeners on scope destroy", function () {
representer.listenHandle = jasmine.createSpy('listen');
mockScope.$on.mostRecentCall.args[1]();
expect(representer.listenHandle).toHaveBeenCalled();
});
it("mutates and persists upon observed changes", function () {
mockScope.model = { someKey: "some value" };
mockScope.configuration = { someConfiguration: "something" };
@@ -112,4 +123,4 @@ define(
});
}
);
);