[About] Update dialog specs

Update tests for dialog/overlay services to match
changes introduced to simplify implementation of
information overlays, such as the About dialog, WTD-667.
This commit is contained in:
Victor Woeltjen 2015-01-14 13:09:41 -08:00
parent c628d88b3e
commit 95393b269e
2 changed files with 8 additions and 8 deletions

View File

@ -56,7 +56,7 @@ define(
it("allows user input to be canceled", function () { it("allows user input to be canceled", function () {
dialogService.getUserInput({}, { someKey: "some value" }); dialogService.getUserInput({}, { someKey: "some value" });
mockOverlayService.createOverlay.mostRecentCall.args[0].cancel(); mockOverlayService.createOverlay.mostRecentCall.args[1].cancel();
expect(mockDeferred.reject).toHaveBeenCalled(); expect(mockDeferred.reject).toHaveBeenCalled();
expect(mockDeferred.resolve).not.toHaveBeenCalled(); expect(mockDeferred.resolve).not.toHaveBeenCalled();
}); });
@ -64,7 +64,7 @@ define(
it("passes back the result of user input when confirmed", function () { it("passes back the result of user input when confirmed", function () {
var value = { someKey: 42 }; var value = { someKey: 42 };
dialogService.getUserInput({}, value); dialogService.getUserInput({}, value);
mockOverlayService.createOverlay.mostRecentCall.args[0].confirm(); mockOverlayService.createOverlay.mostRecentCall.args[1].confirm();
expect(mockDeferred.reject).not.toHaveBeenCalled(); expect(mockDeferred.reject).not.toHaveBeenCalled();
expect(mockDeferred.resolve).toHaveBeenCalledWith(value); expect(mockDeferred.resolve).toHaveBeenCalledWith(value);
}); });
@ -80,7 +80,7 @@ define(
it("can show multiple dialogs if prior ones are dismissed", function () { it("can show multiple dialogs if prior ones are dismissed", function () {
dialogService.getUserInput({}, {}); dialogService.getUserInput({}, {});
expect(mockLog.warn).not.toHaveBeenCalled(); expect(mockLog.warn).not.toHaveBeenCalled();
mockOverlayService.createOverlay.mostRecentCall.args[0].confirm(); mockOverlayService.createOverlay.mostRecentCall.args[1].confirm();
dialogService.getUserInput({}, {}); dialogService.getUserInput({}, {});
expect(mockLog.warn).not.toHaveBeenCalled(); expect(mockLog.warn).not.toHaveBeenCalled();
expect(mockDeferred.reject).not.toHaveBeenCalled(); expect(mockDeferred.reject).not.toHaveBeenCalled();

View File

@ -8,7 +8,7 @@ define(
function (OverlayService) { function (OverlayService) {
"use strict"; "use strict";
describe("The dialog service", function () { describe("The overlay service", function () {
var mockDocument, var mockDocument,
mockCompile, mockCompile,
mockRootScope, mockRootScope,
@ -40,19 +40,19 @@ define(
}); });
it("prepends an mct-include to create overlays", function () { it("prepends an mct-include to create overlays", function () {
overlayService.createOverlay({}, "test"); overlayService.createOverlay("test", {});
expect(mockCompile).toHaveBeenCalled(); expect(mockCompile).toHaveBeenCalled();
expect(mockCompile.mostRecentCall.args[0].indexOf("mct-include")) expect(mockCompile.mostRecentCall.args[0].indexOf("mct-include"))
.not.toEqual(-1); .not.toEqual(-1);
}); });
it("adds the templated element to the body", function () { it("adds the templated element to the body", function () {
overlayService.createOverlay({}, "test"); overlayService.createOverlay("test", {});
expect(mockBody.prepend).toHaveBeenCalledWith(mockElement); expect(mockBody.prepend).toHaveBeenCalledWith(mockElement);
}); });
it("places the provided model/key in its template's scope", function () { it("places the provided model/key in its template's scope", function () {
overlayService.createOverlay({ someKey: 42 }, "test"); overlayService.createOverlay("test", { someKey: 42 });
expect(mockScope.overlay).toEqual({ someKey: 42 }); expect(mockScope.overlay).toEqual({ someKey: 42 });
expect(mockScope.key).toEqual("test"); expect(mockScope.key).toEqual("test");
@ -61,7 +61,7 @@ define(
}); });
it("removes the prepended element on request", function () { it("removes the prepended element on request", function () {
var overlay = overlayService.createOverlay({}, "test"); var overlay = overlayService.createOverlay("test", {});
// Verify precondition // Verify precondition
expect(mockElement.remove).not.toHaveBeenCalled(); expect(mockElement.remove).not.toHaveBeenCalled();