cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimir-kotikov <...@git.apache.org>
Subject [GitHub] cordova-plugin-contacts pull request: CB-10117 Added new tests
Date Tue, 15 Dec 2015 14:57:42 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message