You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/12/03 23:51:18 UTC
[1/3] git commit: CB-5214 Make mobile spec tests on WP8 to run w/o
user interaction + Sync with cordova-mobile-spec
Updated Branches:
refs/heads/dev 72e97f307 -> 5e8f1cc4a
CB-5214 Make mobile spec tests on WP8 to run w/o user interaction + Sync with cordova-mobile-spec
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/aea4c52b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/aea4c52b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/aea4c52b
Branch: refs/heads/dev
Commit: aea4c52bc70b77b34cf1ba974c8ce46fb74efa65
Parents: c8a1c7b
Author: sgrebnov <se...@gmail.com>
Authored: Wed Oct 30 18:15:28 2013 +0400
Committer: sgrebnov <se...@gmail.com>
Committed: Wed Oct 30 18:15:28 2013 +0400
----------------------------------------------------------------------
test/autotest/tests/contacts.tests.js | 76 ++++++++++++++++++++++++++++--
1 file changed, 71 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/aea4c52b/test/autotest/tests/contacts.tests.js
----------------------------------------------------------------------
diff --git a/test/autotest/tests/contacts.tests.js b/test/autotest/tests/contacts.tests.js
index 12520a4..de2955e 100644
--- a/test/autotest/tests/contacts.tests.js
+++ b/test/autotest/tests/contacts.tests.js
@@ -21,8 +21,9 @@
// 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;
-var gContactId = null;
+var gContactObj = null,
+ gContactId = null,
+ isWindowsPhone = cordova.platformId == 'windowsphone';
var removeContact = function(){
if (gContactObj) {
@@ -65,6 +66,26 @@ describe("Contacts (navigator.contacts)", function () {
});
});
+ it("success callback should be called with an array, even if partial ContactFindOptions specified", function () {
+ var win = jasmine.createSpy().andCallFake(function (result) {
+ expect(result).toBeDefined();
+ expect(result instanceof Array).toBe(true);
+ }),
+ fail = jasmine.createSpy();
+
+ runs(function () {
+ navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], win, fail, {
+ multiple: true
+ });
+ });
+
+ waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+ runs(function () {
+ expect(fail).not.toHaveBeenCalled();
+ });
+ });
+
it("contacts.spec.4 should throw an exception if success callback is empty", function() {
var fail = function() {};
var obj = new ContactFindOptions();
@@ -103,6 +124,10 @@ describe("Contacts (navigator.contacts)", function () {
afterEach(removeContact);
it("contacts.spec.6 should be able to find a contact by name", function() {
+
+ // this api requires manual user confirmation on WP7/8 so skip it
+ if (isWindowsPhone) return;
+
var foundName = jasmine.createSpy().andCallFake(function(result) {
var bFound = false;
try {
@@ -163,7 +188,7 @@ describe("Contacts (navigator.contacts)", function () {
describe('create method', function() {
- it("contacts.spec.1 should exist", function() {
+ it("contacts.spec.7 should exist", function() {
expect(navigator.contacts.create).toBeDefined();
expect(typeof navigator.contacts.create).toBe('function');
});
@@ -302,6 +327,10 @@ describe("Contacts (navigator.contacts)", function () {
describe('save method', function () {
it("contacts.spec.20 should be able to save a contact", function() {
+
+ // this api requires manual user confirmation on WP7/8 so skip it
+ if (isWindowsPhone) return;
+
var bDay = new Date(1976, 6,4);
gContactObj = navigator.contacts.create({"gender": "male", "note": "my note", "name": {"familyName": "Delete", "givenName": "Test"}, "emails": [{"value": "here@there.com"}, {"value": "there@here.com"}], "birthday": bDay});
@@ -332,6 +361,10 @@ describe("Contacts (navigator.contacts)", function () {
});
// HACK: there is a reliance between the previous and next test. This is bad form.
it("contacts.spec.21 update a contact", function() {
+
+ // this api requires manual user confirmation on WP7/8 so skip it
+ if (isWindowsPhone) return;
+
expect(gContactObj).toBeDefined();
var bDay = new Date(1975, 5,4);
@@ -408,9 +441,11 @@ describe("Contacts (navigator.contacts)", function () {
});
describe("Round trip Contact tests (creating + save + delete + find).", function () {
- afterEach(removeContact);
-
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() {
+
+ // this api requires manual user confirmation on WP7/8 so skip it
+ if (isWindowsPhone) return;
+
var done = false;
runs(function () {
gContactObj = new Contact();
@@ -469,4 +504,35 @@ describe("Contacts (navigator.contacts)", function () {
expect(ContactError.PERMISSION_DENIED_ERROR).toBe(20);
});
});
+
+ describe("Contacts autotests cleanup", function () {
+ it("contacts.spec.26 Cleanup any DeleteMe contacts from Contacts tests.", function() {
+ var done = false;
+ var obj = new ContactFindOptions();
+ obj.filter="DeleteMe";
+ obj.multiple=true;
+ runs(function () {
+ var findSuccess = function (cs) {
+ var contactObj = new Contact();
+ if (cs.length>0){
+ contactObj = cs[0];
+ contactObj.remove(function(){
+ console.log("[CONTACTS CLEANUP] DeleteMe contact successfully removed");
+ navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], findSuccess, findFail, obj);
+ },function(){
+ console.log("[CONTACTS CLEANUP ERROR]: failed to remove DeleteMe contact");
+ });
+ } else {
+ done = true;
+ }
+ };
+ var findFail = function(e) {
+ throw("Failure callback invoked in navigator.contacts.find call, test failed.");
+ };
+ navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], findSuccess, findFail, obj);
+ });
+ waitsFor(function () { return done; }, Tests.TEST_TIMEOUT);
+ });
+ });
+
});
[3/3] git commit: Merge branch 'dev' of
https://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts into dev
Posted by pu...@apache.org.
Merge branch 'dev' of https://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts into dev
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/5e8f1cc4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/5e8f1cc4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/5e8f1cc4
Branch: refs/heads/dev
Commit: 5e8f1cc4a295bc54fd33203266184b7c1cf0182d
Parents: 1d4aee1 72e97f3
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Dec 3 14:51:03 2013 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Dec 3 14:51:03 2013 -0800
----------------------------------------------------------------------
README.md | 6 +
src/firefoxos/ContactsProxy.js | 335 ++++++++++++++++++++++++++++--------
src/wp/Contacts.cs | 10 +-
3 files changed, 271 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: Merge branch 'CB-5214' of
https://github.com/sgrebnov/cordova-plugin-contacts into dev
Posted by pu...@apache.org.
Merge branch 'CB-5214' of https://github.com/sgrebnov/cordova-plugin-contacts into dev
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/1d4aee1b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/1d4aee1b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/1d4aee1b
Branch: refs/heads/dev
Commit: 1d4aee1b2db39e474d6a4e0660ffe7251155e257
Parents: c070a4f aea4c52
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Dec 3 14:49:46 2013 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Dec 3 14:49:46 2013 -0800
----------------------------------------------------------------------
test/autotest/tests/contacts.tests.js | 76 ++++++++++++++++++++++++++++--
1 file changed, 71 insertions(+), 5 deletions(-)
----------------------------------------------------------------------