Merge branch 'master' into open671

This commit is contained in:
Pete Richards
2016-05-09 10:19:24 -07:00
70 changed files with 2241 additions and 1786 deletions

View File

@@ -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(
});
}
);
);