[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:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user