Github user vladimir-kotikov commented on a diff in the pull request:
https://github.com/apache/cordova-plugin-contacts/pull/99#discussion_r47645743
--- Diff: tests/tests.js ---
@@ -618,20 +720,86 @@ exports.defineManualTests = function(contentEl,
createActionButton) {
}
});
} catch (e) {
- alert(e);
+ console.error(e.message);
}
}
- function removeDooneyEvans() {
+ function addDooneyEvans() {
+ var displayName = "Dooney Evans";
+ var contactName = {
+ formatted: "Dooney Evans",
+ familyName: "Evans",
+ givenName: "Dooney",
+ middleName: ""
+ };
+ var phoneNumber = '512-555-1234';
+ var birthday = new Date(1985, 0, 23);
+
+ addContact(displayName, contactName, phoneNumber, birthday);
+ }
+
+ function addNamelessContact() {
+ addContact();
+ }
+
+ function addUnicodeContact() {
+ var displayName = "Ðâ¬Ð¹ÑомонаÑ
\nФеоÑаÐ";
+ var contactName = {
+ formatted: "Ðâ¬Ð¹ÑомонаÑ
\nФеоÑаÐ",
+ familyName: "\nФеоÑаÐ",
+ givenName: "Ðâ¬Ð¹ÑомонаÑ
",
+ middleName: ""
+ };
+
+ addContact(displayName, contactName);
+ }
+
+ function renameDooneyEvans() {
var results = document.getElementById('contact_results');
+ var obj = new ContactFindOptions();
+ obj.filter = 'Dooney Evans';
+ obj.multiple = false;
- navigator.contacts.find(["displayName", "name", "phoneNumbers",
"emails", "urls", "note"], function(contacts) {
+ navigator.contacts.find(['displayName', 'name'],
function(contacts) {
+ if (contacts.length == 0) {
+ results.innerHTML = 'No contacts to update.';
+ return;
+ }
+ var contact = contacts[0];
+ contact.displayName = "Urist McContact";
+ var name = new ContactName();
+ name.givenName = "Urist";
+ name.familyName = "McContact";
+ contact.name = name;
+ contact.save(function(updated) {
+ results.innerHTML = 'Contact updated.';
+ },function(e) {
+ results.innerHTML = 'Update failed: error ' + e.code;
+ });
+ }, function(e) {
+ if (e.code === ContactError.NOT_SUPPORTED_ERROR) {
+ results.innerHTML = 'Searching for contacts is not
supported.';
+ } else {
+ results.innerHTML = 'Search failed: error ' + e.code;
+ }
+ }, obj)
+ }
+
+ function removeTestContacts() {
--- End diff --
Is it possible to reuse `removeContactsByFields` here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]