From 1e6d16ba87f26c7a9c764b5932f1773273f97081 Mon Sep 17 00:00:00 2001 From: sagiegurari Date: Thu, 27 Aug 2015 23:09:16 +0300 Subject: [PATCH] more tests --- docs/api.md | 1 + test/spec/angular-web-notification-spec.js | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/docs/api.md b/docs/api.md index cf23fa7..7567411 100644 --- a/docs/api.md +++ b/docs/api.md @@ -40,6 +40,7 @@ case of no errors) and a 'hide' function which can be used to hide the notificat | --- | --- | --- | | [title] | string | The notification title text (defaulted to empty string if null is provided) | | [options] | object | Holds the notification data (web notification API spec for more info) | +| [options.autoClose] | number | Auto closes the notification after the provided amount of millies (0 or undefined for no auto close) | | callback | [ShowNotificationCallback](#ShowNotificationCallback) | Called after the show is handled. | **Example** diff --git a/test/spec/angular-web-notification-spec.js b/test/spec/angular-web-notification-spec.js index 060e622..fb7556c 100644 --- a/test/spec/angular-web-notification-spec.js +++ b/test/spec/angular-web-notification-spec.js @@ -56,6 +56,31 @@ describe('angular-web-notification', function () { }); }); + it('showNotification with auto close test', function (done) { + inject(function (webNotification) { + window.notify.setAllowed(function (title, options) { + assert.equal(title, 'Example Notification'); + assert.deepEqual(options, { + body: 'Notification Text...', + icon: 'my-icon.ico', + autoClose: 600 + }); + }); + + webNotification.showNotification('Example Notification', { + body: 'Notification Text...', + icon: 'my-icon.ico', + autoClose: 600 + }, function onShow(error, hide) { + assert.deepEqual(window.notify.getConfig(), { + autoClose: 600 + }); + + validShowValidation(error, hide, done); + }); + }); + }); + it('showNotification no params test', function (done) { inject(function (webNotification) { window.notify.setAllowed(emptyValuesValidation);