You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/11/19 14:29:54 UTC
cordova-plugin-contacts git commit: CB-7021 Adds manual test for
pickContact
Repository: cordova-plugin-contacts
Updated Branches:
refs/heads/master f282464d1 -> 8929422fe
CB-7021 Adds manual test for pickContact
This closes #83
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/8929422f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/tree/8929422f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/diff/8929422f
Branch: refs/heads/master
Commit: 8929422fe42b85c6b680618922e068336d51a0b1
Parents: f282464
Author: Vladimir Kotikov <ko...@gmail.com>
Authored: Thu Nov 19 16:15:24 2015 +0300
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Thu Nov 19 16:29:17 2015 +0300
----------------------------------------------------------------------
tests/tests.js | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts/blob/8929422f/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 01fe928..a9baa27 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -525,6 +525,23 @@ exports.defineManualTests = function(contentEl, createActionButton) {
}, obj);
}
+ function pickContact() {
+ var results = document.getElementById('contact_results');
+ navigator.contacts.pickContact(
+ function (contact) {
+ results.innerHTML = contact ?
+ "Picked contact: <pre>" + JSON.stringify(contact, null, 4) + "</pre>" :
+ "No contacts found";
+
+ },
+ function (e) {
+ results.innerHTML = (e && e.code === ContactError.NOT_SUPPORTED_ERROR) ?
+ "Searching for contacts is not supported." :
+ "Pick failed: error " + (e && e.code);
+ }
+ );
+ }
+
function addContact() {
var results = document.getElementById('contact_results');
@@ -606,7 +623,18 @@ exports.defineManualTests = function(contentEl, createActionButton) {
/******************************************************************************/
- contentEl.innerHTML = '<div id="info">' + '<b>Results:</b><br>' + '<div id="contact_results"></div>' + '</div>' + '<div id="get_contacts"></div>' + 'Expected result: Status box will show number of contacts and list them. May be empty on a fresh device until you click Add.' + '</p> <div id="add_contact"></div>' + 'Expected result: Will add a new contact. Log will say "Contact saved." or "Saving contacts not supported." if not supported on current platform. Verify by running Get phone contacts again' + '<div id="remove_dooney_evans"></div>' + '<p>Expected result: Will remove any contacts named "Dooney Evans". Log will output success or failure, plus ID, or fail like getting contacts will fail.</p>';
+ contentEl.innerHTML = '<div id="info">' +
+ '<b>Results:</b><br>' +
+ '<div id="contact_results"></div>' +
+ '</div>' +
+ '<div id="get_contacts"></div>' +
+ 'Expected result: Status box will show number of contacts and list them. May be empty on a fresh device until you click Add.' +
+ '<div id="pick_contact"></div>' +
+ 'Expected result: Device\'s address book will be shown. After picking a contact status box will show Contact object, passed to success callback</p>' +
+ '<div id="add_contact"></div>' +
+ 'Expected result: Will add a new contact. Log will say "Contact saved." or "Saving contacts not supported." if not supported on current platform. Verify by running Get phone contacts again' +
+ '<div id="remove_dooney_evans"></div>' +
+ '<p>Expected result: Will remove any contacts named "Dooney Evans". Log will output success or failure, plus ID, or fail like getting contacts will fail.</p>';
createActionButton("Get phone's contacts", function() {
getContacts();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org