diff --git a/platform/commonUI/dialog/src/DialogService.js b/platform/commonUI/dialog/src/DialogService.js index 956b812bcf..147666765d 100644 --- a/platform/commonUI/dialog/src/DialogService.js +++ b/platform/commonUI/dialog/src/DialogService.js @@ -37,7 +37,7 @@ define( // OK button click function confirm(value) { // Pass along the result - deferred.resolve(resultGetter(value)); + deferred.resolve(resultGetter ? resultGetter() : value); // Stop showing the dialog dismiss(); @@ -94,6 +94,7 @@ define( return overlayModel.value; } + // Show the overlay-dialog return getDialogResponse( "overlay-dialog", overlayModel, @@ -102,15 +103,10 @@ define( } function getUserChoice(dialogModel) { - // We just want to pass back the result from the template - function echo(value) { - return value; - } - + // Show the overlay-options dialog return getDialogResponse( "overlay-options", - { dialog: dialogModel }, - echo + { dialog: dialogModel } ); } diff --git a/platform/commonUI/dialog/test/DialogServiceSpec.js b/platform/commonUI/dialog/test/DialogServiceSpec.js index 9f3635cd9e..7df54b6e8c 100644 --- a/platform/commonUI/dialog/test/DialogServiceSpec.js +++ b/platform/commonUI/dialog/test/DialogServiceSpec.js @@ -86,6 +86,19 @@ define( expect(mockDeferred.reject).not.toHaveBeenCalled(); }); + it("provides an options dialogs", function () { + var dialogModel = {}; + dialogService.getUserChoice(dialogModel); + expect(mockOverlayService.createOverlay).toHaveBeenCalledWith( + 'overlay-options', + { + dialog: dialogModel, + confirm: jasmine.any(Function), + cancel: jasmine.any(Function) + } + ); + }); + }); } ); \ No newline at end of file