cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject cordova-plugin-contacts git commit: mark tests as pending if iOS permission is blocked. CB-9905
Date Wed, 04 Nov 2015 06:32:50 GMT
Repository: cordova-plugin-contacts
Updated Branches:
  refs/heads/master 1b497df32 -> d404eec6e


mark tests as pending if iOS permission is blocked. CB-9905


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/commit/d404eec6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/d404eec6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/d404eec6

Branch: refs/heads/master
Commit: d404eec6eab461d130dd76de0a24655fe1588d48
Parents: 1b497df
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Tue Nov 3 22:31:25 2015 -0800
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Tue Nov 3 22:32:40 2015 -0800

----------------------------------------------------------------------
 tests/tests.js | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/d404eec6/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index b115673..2889430 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -23,10 +23,13 @@ exports.defineAutoTests = function () {
   // global to store a contact so it doesn't have to be created or retrieved multiple times
   // all of the setup/teardown test methods can reference the following variables to make
sure to do the right cleanup
   var gContactObj = null,
-    gContactId = null,
-    isWindowsPhone8 = cordova.platformId == 'windowsphone',
-    isWindows = (cordova.platformId === "windows") || (cordova.platformId === "windows8"),
-    isWindowsPhone81 =  isWindows && WinJS.Utilities.isPhone;
+gContactId = null,
+isWindowsPhone8 = cordova.platformId == 'windowsphone',
+isWindows = (cordova.platformId === "windows") || (cordova.platformId === "windows8"),
+isWindowsPhone81 =  isWindows && WinJS.Utilities.isPhone;
+               
+  var isIOSPermissionBlocked = false;
+               
   var fail = function(done) {
     expect(true).toBe(false);
     done();
@@ -67,11 +70,18 @@ exports.defineAutoTests = function () {
 
               obj.filter="";
               obj.multiple=true;
-              navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"],
win, fail.bind(null, done), obj);
+
+            function failed(err) {
+              if(err.code == ContactError.PERMISSION_DENIED_ERROR) {
+                  isIOSPermissionBlocked = true;
+                  done();
+              }
+            }
+            navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], win,failed,
obj);
           });
           it("success callback should be called with an array, even if partial ContactFindOptions
specified", function (done) {
               // Find method is not supported on Windows platform
-              if (isWindows && !isWindowsPhone81) {
+              if ((isWindows && !isWindowsPhone81) || isIOSPermissionBlocked) {
                   pending();
                   return;
               }
@@ -113,7 +123,7 @@ exports.defineAutoTests = function () {
               it("contacts.spec.6 should be able to find a contact by name", function (done)
{
                   // Find method is not supported on Windows Store apps.
                   // also this test will be skipped for Windows Phone 8.1 because function
"save" not supported on WP8.1
-                  if (isWindows || isWindowsPhone8) {
+                  if (isWindows || isWindowsPhone8 || isIOSPermissionBlocked)  {
                       pending();
                   }
 
@@ -289,7 +299,7 @@ exports.defineAutoTests = function () {
       describe('save method', function () {
           it("contacts.spec.20 should be able to save a contact", function (done) {
               // Save method is not supported on Windows platform
-              if (isWindows || isWindowsPhone8) {
+              if (isWindows || isWindowsPhone8 || isIOSPermissionBlocked) {
                   pending();
               }
 
@@ -317,7 +327,7 @@ exports.defineAutoTests = function () {
           // HACK: there is a reliance between the previous and next test. This is bad form.
           it("contacts.spec.21 update a contact", function (done) {
               // Save method is not supported on Windows platform
-              if (isWindows || isWindowsPhone8) {
+              if (isWindows || isWindowsPhone8 || isIOSPermissionBlocked) {
                   pending();
               }
 
@@ -361,7 +371,7 @@ exports.defineAutoTests = function () {
           });
           it("contacts.spec.23 calling remove on a contact that does not exist should return
ContactError.UNKNOWN_ERROR", function(done) {
                // remove method is not supported on Windows platform
-              if (isWindows || isWindowsPhone8) {
+              if (isWindows || isWindowsPhone8 || isIOSPermissionBlocked) {
                   pending();
               }
               var rmWin = fail;
@@ -381,7 +391,7 @@ exports.defineAutoTests = function () {
 
           it("contacts.spec.24 Creating, saving, finding a contact should work, removing
it should work, after which we should not be able to find it, and we should not be able to
delete it again.", function (done) {
               // Save method is not supported on Windows platform
-              if (isWindows || isWindowsPhone8) {
+              if (isWindows || isWindowsPhone8 || isIOSPermissionBlocked) {
                   pending();
               }
               // First, count already existing 'DeleteMe' contacts, if any


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message