From fe4df885d650724e5f11ccbc024c518a6d34d0fd Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Thu, 16 Nov 2017 00:29:24 -0600 Subject: [PATCH] add tests --- spec/notification-manager-spec.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/notification-manager-spec.js b/spec/notification-manager-spec.js index 3f6a20b67..b62569ee6 100644 --- a/spec/notification-manager-spec.js +++ b/spec/notification-manager-spec.js @@ -66,4 +66,27 @@ describe('NotificationManager', () => { expect(notification.getType()).toBe('success') }) }) + + describe('clearing notifications', function () { + it('clears the notifications when ::clear has been called', function(){ + manager.addSuccess('success') + expect(manager.getNotifications().length).toBe(1) + manager.clear() + expect(manager.getNotifications().length).toBe(0) + }) + + describe('adding events', () => { + let addSpy + + beforeEach(() => { + addSpy = jasmine.createSpy() + manager.onDidClearNotifications(addSpy) + }) + + it('emits an event when the notifications have been cleared', () => { + manager.clear() + expect(addSpy).toHaveBeenCalled() + }) + }) + }) })