From d63c401e4463f6d725f6c079c5217dfbfe06e7ba Mon Sep 17 00:00:00 2001 From: Alex M Date: Sat, 29 Oct 2016 11:18:07 +0300 Subject: [PATCH] [Notifications] Remove custom autoDismiss --- .../notification/src/NotificationService.js | 11 ++----- .../test/NotificationServiceSpec.js | 33 ------------------- 2 files changed, 3 insertions(+), 41 deletions(-) diff --git a/platform/commonUI/notification/src/NotificationService.js b/platform/commonUI/notification/src/NotificationService.js index 3d9c92db90..3cdc442271 100644 --- a/platform/commonUI/notification/src/NotificationService.js +++ b/platform/commonUI/notification/src/NotificationService.js @@ -61,7 +61,7 @@ define( * @property {boolean} [unknownProgress] a boolean indicating that the * progress of the underlying task is unknown. This will result in a * visually distinct progress bar. - * @property {boolean | number} [autoDismiss] If truthy, dialog will + * @property {boolean} [autoDismiss] If truthy, dialog will * be automatically minimized or dismissed (depending on severity). * Additionally, if the provided value is a number, it will be used * as the delay period before being dismissed. @@ -384,9 +384,7 @@ define( * @private */ NotificationService.prototype.setActiveNotification = function (notification) { - var timeout; var shouldAutoDismiss; - var usesCustomTimeout; this.active.notification = notification; if (!notification) { @@ -394,19 +392,16 @@ define( return; } - usesCustomTimeout = typeof notification.model.autoDismiss === "number"; - - if (notification.model.severity === "info" || usesCustomTimeout) { + if (notification.model.severity === "info") { shouldAutoDismiss = true; } else { shouldAutoDismiss = notification.model.autoDismiss; } if (shouldAutoDismiss || this.selectNextNotification()) { - timeout = usesCustomTimeout ? notification.model.autoDismiss : this.AUTO_DISMISS_TIMEOUT; this.active.timeout = this.$timeout(function () { notification.dismissOrMinimize(); - }, timeout); + }, this.AUTO_DISMISS_TIMEOUT); } else { delete this.active.timeout; } diff --git a/platform/commonUI/notification/test/NotificationServiceSpec.js b/platform/commonUI/notification/test/NotificationServiceSpec.js index 5645c185ea..c722c8e468 100644 --- a/platform/commonUI/notification/test/NotificationServiceSpec.js +++ b/platform/commonUI/notification/test/NotificationServiceSpec.js @@ -118,17 +118,6 @@ define( expect(notificationService.getActiveNotification()).toBeUndefined(); expect(notificationService.notifications.length).toEqual(0); }); - - it("uses a custom auto-dismiss timeout value if provided", function () { - var timeoutValueInModel = 1500; - var timeoutValueUsedByService = 0; - mockTimeout.andCallFake(function (callback, timeout) { - timeoutValueUsedByService = timeout; - }); - infoModel.autoDismiss = timeoutValueInModel; - notificationService.info(infoModel); - expect(timeoutValueUsedByService).toEqual(timeoutValueInModel); - }); }); describe("when receiving alert notifications", function () { @@ -162,17 +151,6 @@ define( expect(notificationService.notifications.length).toEqual(1); expect(notificationService.notifications[0]).toEqual(notification); }); - - it("uses a custom auto-dismiss timeout value if provided", function () { - var timeoutValueInModel = 1500; - var timeoutValueUsedByService = 0; - mockTimeout.andCallFake(function (callback, timeout) { - timeoutValueUsedByService = timeout; - }); - alertModel.autoDismiss = timeoutValueInModel; - notificationService.alert(alertModel); - expect(timeoutValueUsedByService).toEqual(timeoutValueInModel); - }); }); describe("when receiving error notifications", function () { @@ -206,17 +184,6 @@ define( expect(notificationService.notifications.length).toEqual(1); expect(notificationService.notifications[0]).toEqual(notification); }); - - it("uses a custom auto-dismiss timeout value if provided", function () { - var timeoutValueInModel = 1500; - var timeoutValueUsedByService = 0; - mockTimeout.andCallFake(function (callback, timeout) { - timeoutValueUsedByService = timeout; - }); - errorModel.autoDismiss = timeoutValueInModel; - notificationService.error(errorModel); - expect(timeoutValueUsedByService).toEqual(timeoutValueInModel); - }); }); describe("when called with multiple notifications", function () {