Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding a few tests to contacts and notification

  • Loading branch information...
commit 4bdb895b21512279924b6dce10913da55aa44bfc 1 parent 87da1c5
@macdonst macdonst authored brycecurtis committed
Showing with 18 additions and 0 deletions.
  1. +13 −0 tests/contacts.tests.js
  2. +5 −0 tests/notification.tests.js
View
13 tests/contacts.tests.js
@@ -9,6 +9,19 @@ Tests.prototype.ContactsTests = function() {
ok(typeof navigator.service.contacts.find != 'undefined' && navigator.service.contacts.find != null, "navigator.service.contacts.find should not be null.");
ok(typeof navigator.service.contacts.find == 'function', "navigator.service.contacts.find should be a function.");
});
+ test("contacts.find success callback should be called with an array", function() {
+ expect(2);
+ stop(tests.TEST_TIMEOUT);
+ var win = function(result) {
+ ok(typeof result == 'object', "Object returned in contacts.find success callback is of type 'object' (actually array).");
+ ok(typeof result.length == 'number', "Object returned in contacts.find success callback has a length property which is numerical.");
+ start();
+ };
+ var fail = function() { start(); };
+ var filter = new Contact();
+ filter.name.formatted = '';
+ navigator.service.contacts.find(filter, win, fail);
+ });
module("Contact model");
test("should be able to define a Contact object", function() {
expect(24);
View
5 tests/notification.tests.js
@@ -14,4 +14,9 @@ Tests.prototype.NotificationTests = function() {
ok(typeof navigator.notification.beep != 'undefined' && navigator.notification.beep != null, "navigator.notification.beep should not be null.");
ok(typeof navigator.notification.beep == 'function', "navigator.notification.beep should be a function.");
});
+ test("should contain a alert function", function() {
+ expect(2);
+ ok(typeof navigator.notification.alert != 'undefined' && navigator.notification.alert != null, "navigator.notification.alert should not be null.");
+ ok(typeof navigator.notification.alert == 'function', "navigator.notification.alert should be a function.");
+ });
};
Please sign in to comment.
Something went wrong with that request. Please try again.