[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

@@ -31,6 +31,7 @@ define(
mockScope,
testAttrs,
mockEvent,
mockNavigationService,
directive;
function fireListener(eventType, value) {
@@ -46,7 +47,8 @@ define(
mockScope = jasmine.createSpyObj("$scope", ['$eval', '$on']);
testAttrs = { mctBeforeUnload: "someExpression" };
mockEvent = jasmine.createSpyObj("event", ["preventDefault"]);
directive = new MCTBeforeUnload(mockWindow);
mockNavigationService = jasmine.createSpyObj("navigationService", ["addListener", "removeListener"]);
directive = new MCTBeforeUnload(mockWindow, mockNavigationService);
directive.link(mockScope, {}, testAttrs);
});
@@ -65,6 +67,10 @@ define(
);
});
it("listens for navigation changes", function () {
expect(mockNavigationService.addListener).toHaveBeenCalledWith(jasmine.any(Function), "before");
});
it("listens for its scope's destroy event", function () {
expect(mockScope.$on).toHaveBeenCalledWith(
"$destroy",
@@ -108,9 +114,10 @@ define(
it("cleans up listeners when destroyed", function () {
fireListener("$destroy", mockEvent);
expect(mockWindow.onbeforeunload).toBeUndefined();
expect(mockNavigationService.removeListener).toHaveBeenCalled();
});
});
}
);
);