Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sagiegurari committed Aug 27, 2015
1 parent 77e5674 commit 1e6d16b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ case of no errors) and a 'hide' function which can be used to hide the notificat
| --- | --- | --- |
| [title] | <code>string</code> | The notification title text (defaulted to empty string if null is provided) |
| [options] | <code>object</code> | Holds the notification data (web notification API spec for more info) |
| [options.autoClose] | <code>number</code> | Auto closes the notification after the provided amount of millies (0 or undefined for no auto close) |
| callback | <code>[ShowNotificationCallback](#ShowNotificationCallback)</code> | Called after the show is handled. |

**Example**
Expand Down
25 changes: 25 additions & 0 deletions test/spec/angular-web-notification-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1e6d16b

Please sign in to comment.