- From: Dominique Hazael-Massieux via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 24 May 2011 08:07:22 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/contacts/tests/test-cases
In directory hutz:/tmp/cvs-serv31642
Added Files:
find_two-results.html jane.vcf joe.vcf
Log Message:
one more test cases
--- NEW FILE: find_two-results.html ---
<!doctype html>
<html>
<head>
<title>Contacts API - Compare two results with expected results</title>
<script src="../impl.js"></script>
<script src="http://w3c-test.org/html/tests/resources/testharness.js"></script>
<script src="http://w3c-test.org/html/tests/resources/testharnessreport.js"></script>
<script src="common.js"></script>
</head>
<body>
<p>This test assumes that the <a href="joe.vcf">contacts data for Joe Lambda</a> and <a href="jane.vcf">for Jane Doe</a> have been loaded in the underlying addressbook.</p>
<p>Please select both Joe Lambda and Jane Doe (and only them) when prompted.</p>
<div id="log"></div>
<script>
var t = async_test("Joe Lambda and Jane Doe properly returned", {timeout: 15000});
var joeContact = {"id": "whatever",
"displayName": "Joe Lambda",
"name": { "familyName": "Lambda",
"formatted": "Joe Lambda",
"givenName": "Joe",
"honorificPrefix": null,
"honorificSuffix": null,
"middleName": null},
"nickname": "Joe",
"phoneNumbers": null,
"emails": null,
"addresses": null,
"ims": null,
"organizations": null,
"revision": null,
"birthday": null,
"gender": null,
"note": null,
"photos": null,
"categories": null,
"urls": null,
"timezone": null};
var janeContact = {"id": "whatever",
"displayName": "Jane Doe",
"name": { "familyName": "Doe",
"formatted": "Jane Doe",
"givenName": "Jane",
"honorificPrefix": null,
"honorificSuffix": null,
"middleName": null},
"nickname": "Jane",
"phoneNumbers": null,
"emails": null,
"addresses": null,
"ims": null,
"organizations": null,
"revision": null,
"birthday": null,
"gender": null,
"note": null,
"photos": null,
"categories": null,
"urls": null,
"timezone": null};
navigator.contacts.find(["id", "displayName", "name", "nickname"], function (contacts) {
t.step(function () {
assert_equals(contacts.length, 2, "Expected two results from query");
assert_is_contact(contacts[0]);
assert_is_contact(contacts[1]);
});
var firstContactGiven = contacts[0]["name"]["givenName"];
var firstContact = joeContact;
var secondContact = janeContact;
if (firstContactGiven == "Jane") {
var firstContact = janeContact;
var secondContact = joeContact;
} else if (firstContactGiven != "Joe") {
assert_unreached("Unexpected given name in results: " + firstContactGiven);
}
t.step(function () {
assert_contact_same_as(contacts[0], firstContact);
});
t.step(function() {
assert_contact_same_as(contacts[1], secondContact);
t.done();
});
}, null, {multiple: true});
</script>
</body>
</html>
--- NEW FILE: joe.vcf ---
BEGIN:vCard
VERSION:3.0
FN:Joe Lambda
ORG:ACME Inc.
ADR;TYPE=WORK,POSTAL,PARCEL:;;2225 Acme Drive
;Raleigh;NC;27613-3502;U.S.A.
TEL;TYPE=VOICE,MSG,WORK:+1-919-555-9515
TEL;TYPE=FAX,WORK:+1-919-555-9564
EMAIL;TYPE=INTERNET,PREF:jlambda@example.com
EMAIL;TYPE=INTERNET:jlambda@example.net
URL:http://example.net/~jlambda/
END:vCard
--- NEW FILE: jane.vcf ---
BEGIN:vCard
VERSION:3.0
FN:Jane Doe
ORG:ACME Inc.
ADR;TYPE=WORK,POSTAL,PARCEL:;;2225 Acme Drive
;Raleigh;NC;27613-3502;U.S.A.
TEL;TYPE=VOICE,MSG,WORK:+1-808-555-9515
TEL;TYPE=FAX,WORK:+1-808-555-9564
EMAIL;TYPE=INTERNET,PREF:jdoe@example.com
EMAIL;TYPE=INTERNET:jdoe@example.net
URL:http://example.net/~jdoe/
END:vCard
Received on Tuesday, 24 May 2011 08:07:23 UTC