From bfdf7b822fad5c189fe5d997c95d836b17663e0d Mon Sep 17 00:00:00 2001 From: Alex M Date: Sun, 16 Oct 2016 15:34:11 +0300 Subject: [PATCH] [Notifications] Cover direct dismiss and minimize --- .../test/NotificationServiceSpec.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/platform/commonUI/notification/test/NotificationServiceSpec.js b/platform/commonUI/notification/test/NotificationServiceSpec.js index 2c90dce621..5645c185ea 100644 --- a/platform/commonUI/notification/test/NotificationServiceSpec.js +++ b/platform/commonUI/notification/test/NotificationServiceSpec.js @@ -76,6 +76,22 @@ define( expect(dismissListener).toHaveBeenCalled(); }); + it("dismisses a notification when the notification's dismiss method is used", function () { + var notification = notificationService.info(infoModel); + notification.dismiss(); + expect(notificationService.getActiveNotification()).toBeUndefined(); + expect(notificationService.notifications.length).toEqual(0); + }); + + it("minimizes a notification when the notification's minimize method is used", function () { + var notification = notificationService.info(infoModel); + notification.minimize(); + elapseTimeout(); // needed for the minimize animation timeout + expect(notificationService.getActiveNotification()).toBeUndefined(); + expect(notificationService.notifications.length).toEqual(1); + expect(notificationService.notifications[0]).toEqual(notification); + }); + describe("when receiving info notifications", function () { it("minimizes info notifications if the caller disables auto-dismiss", function () { infoModel.autoDismiss = false; @@ -95,7 +111,7 @@ define( expect(notificationService.notifications.length).toEqual(0); }); - it("dismisses info notifications if the caller requests auto-dismissal", function () { + it("dismisses info notifications if the caller requests auto-dismiss", function () { infoModel.autoDismiss = true; notificationService.info(infoModel); elapseTimeout();