Merge branch 'master' into open671
This commit is contained in:
@@ -25,20 +25,20 @@ define(
|
||||
function (ClickAwayController) {
|
||||
|
||||
describe("The click-away controller", function () {
|
||||
var mockScope,
|
||||
mockDocument,
|
||||
var mockDocument,
|
||||
mockTimeout,
|
||||
controller;
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ "$apply" ]
|
||||
);
|
||||
mockDocument = jasmine.createSpyObj(
|
||||
"$document",
|
||||
[ "on", "off" ]
|
||||
);
|
||||
controller = new ClickAwayController(mockScope, mockDocument);
|
||||
mockTimeout = jasmine.createSpy('timeout');
|
||||
controller = new ClickAwayController(
|
||||
mockDocument,
|
||||
mockTimeout
|
||||
);
|
||||
});
|
||||
|
||||
it("is initially inactive", function () {
|
||||
@@ -77,10 +77,12 @@ define(
|
||||
});
|
||||
|
||||
it("deactivates and detaches listener on document click", function () {
|
||||
var callback;
|
||||
var callback, timeout;
|
||||
controller.setState(true);
|
||||
callback = mockDocument.on.mostRecentCall.args[1];
|
||||
callback();
|
||||
timeout = mockTimeout.mostRecentCall.args[0];
|
||||
timeout();
|
||||
expect(controller.isActive()).toEqual(false);
|
||||
expect(mockDocument.off).toHaveBeenCalledWith("mouseup", callback);
|
||||
});
|
||||
@@ -89,4 +91,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user