[Edit Mode] #627 Fixed failing tests
Removed reference to defunct NavigationServiceDecorator Removed virtual panels from drop gesture
This commit is contained in:
@@ -89,25 +89,25 @@ define(
|
||||
|
||||
controller = new EditObjectController(
|
||||
mockScope,
|
||||
mockLocation
|
||||
mockLocation,
|
||||
mockPolicyService
|
||||
);
|
||||
});
|
||||
|
||||
it("exposes a warning message for unload", function () {
|
||||
var obj = mockObject,
|
||||
mockEditor = jasmine.createSpyObj('editor', ['dirty']);
|
||||
errorMessage = "Unsaved changes";
|
||||
|
||||
// Normally, should be undefined
|
||||
expect(controller.getUnloadWarning()).toBeUndefined();
|
||||
|
||||
// Override the object's editor capability, make it look
|
||||
// like there are unsaved changes.
|
||||
mockCapabilities.editor = mockEditor;
|
||||
mockEditor.dirty.andReturn(true);
|
||||
mockStatusCapability.get.andReturn(true);
|
||||
// Override the policy service to prevent navigation
|
||||
mockPolicyService.allow.andCallFake(function(category, object, context, callback){
|
||||
callback(errorMessage);
|
||||
});
|
||||
|
||||
// Should have some warning message here now
|
||||
expect(controller.getUnloadWarning()).toEqual(jasmine.any(String));
|
||||
expect(controller.getUnloadWarning()).toEqual(errorMessage);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ define(
|
||||
mockScope,
|
||||
testAttrs,
|
||||
mockEvent,
|
||||
mockNavigationService,
|
||||
directive;
|
||||
|
||||
function fireListener(eventType, value) {
|
||||
@@ -47,8 +46,7 @@ define(
|
||||
mockScope = jasmine.createSpyObj("$scope", ['$eval', '$on']);
|
||||
testAttrs = { mctBeforeUnload: "someExpression" };
|
||||
mockEvent = jasmine.createSpyObj("event", ["preventDefault"]);
|
||||
mockNavigationService = jasmine.createSpyObj("navigationService", ["addListener", "removeListener"]);
|
||||
directive = new MCTBeforeUnload(mockWindow, mockNavigationService);
|
||||
directive = new MCTBeforeUnload(mockWindow);
|
||||
directive.link(mockScope, {}, testAttrs);
|
||||
});
|
||||
|
||||
@@ -67,10 +65,6 @@ 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",
|
||||
@@ -114,10 +108,9 @@ 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