mirror of
https://github.com/nasa/openmct.git
synced 2025-01-03 03:46:42 +00:00
[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:
parent
c628d88b3e
commit
95393b269e
@ -56,7 +56,7 @@ define(
|
||||
|
||||
it("allows user input to be canceled", function () {
|
||||
dialogService.getUserInput({}, { someKey: "some value" });
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[0].cancel();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].cancel();
|
||||
expect(mockDeferred.reject).toHaveBeenCalled();
|
||||
expect(mockDeferred.resolve).not.toHaveBeenCalled();
|
||||
});
|
||||
@ -64,7 +64,7 @@ define(
|
||||
it("passes back the result of user input when confirmed", function () {
|
||||
var value = { someKey: 42 };
|
||||
dialogService.getUserInput({}, value);
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[0].confirm();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].confirm();
|
||||
expect(mockDeferred.reject).not.toHaveBeenCalled();
|
||||
expect(mockDeferred.resolve).toHaveBeenCalledWith(value);
|
||||
});
|
||||
@ -80,7 +80,7 @@ define(
|
||||
it("can show multiple dialogs if prior ones are dismissed", function () {
|
||||
dialogService.getUserInput({}, {});
|
||||
expect(mockLog.warn).not.toHaveBeenCalled();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[0].confirm();
|
||||
mockOverlayService.createOverlay.mostRecentCall.args[1].confirm();
|
||||
dialogService.getUserInput({}, {});
|
||||
expect(mockLog.warn).not.toHaveBeenCalled();
|
||||
expect(mockDeferred.reject).not.toHaveBeenCalled();
|
||||
|
@ -8,7 +8,7 @@ define(
|
||||
function (OverlayService) {
|
||||
"use strict";
|
||||
|
||||
describe("The dialog service", function () {
|
||||
describe("The overlay service", function () {
|
||||
var mockDocument,
|
||||
mockCompile,
|
||||
mockRootScope,
|
||||
@ -40,19 +40,19 @@ define(
|
||||
});
|
||||
|
||||
it("prepends an mct-include to create overlays", function () {
|
||||
overlayService.createOverlay({}, "test");
|
||||
overlayService.createOverlay("test", {});
|
||||
expect(mockCompile).toHaveBeenCalled();
|
||||
expect(mockCompile.mostRecentCall.args[0].indexOf("mct-include"))
|
||||
.not.toEqual(-1);
|
||||
});
|
||||
|
||||
it("adds the templated element to the body", function () {
|
||||
overlayService.createOverlay({}, "test");
|
||||
overlayService.createOverlay("test", {});
|
||||
expect(mockBody.prepend).toHaveBeenCalledWith(mockElement);
|
||||
});
|
||||
|
||||
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.key).toEqual("test");
|
||||
|
||||
@ -61,7 +61,7 @@ define(
|
||||
});
|
||||
|
||||
it("removes the prepended element on request", function () {
|
||||
var overlay = overlayService.createOverlay({}, "test");
|
||||
var overlay = overlayService.createOverlay("test", {});
|
||||
|
||||
// Verify precondition
|
||||
expect(mockElement.remove).not.toHaveBeenCalled();
|
||||
|
Loading…
Reference in New Issue
Block a user