test with all fields requested
authorDominique Hazaël-Massieux <dom@w3.org>
Wed, 25 May 2011 14:34:13 +0200
changeset 6 677fc613073e
parent 5 c6082e46771d
child 7 95eebd38e5cc
test with all fields requested
contacts/tests/test-cases/find_all_fields.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contacts/tests/test-cases/find_all_fields.html	Wed May 25 14:34:13 2011 +0200
@@ -0,0 +1,66 @@
+<!doctype html>
+<html>
+ <head>
+  <title>Contacts API - Compare one result with expected result</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> have been loaded in the underlying addressbook.</p>
+   <p>Please select Joe Lambda when prompted.</p>
+   <div id="log"></div>
+   <script>
+     var t = async_test("Joe Lambda properly returned", {timeout: 15000});
+     var joeContact = {	"id": "SDFSDF80789SD6F967986",
+	"displayName": "Joe Lambda",
+	"name": { "familyName": "Lambda",
+		  "formatted": "Joe Lambda",
+		  "givenName": "Joe",
+		  "honorificPrefix": null,
+		  "honorificSuffix": null,
+		  "middleName": null},
+	"nickname": "Joe",
+	"phoneNumbers": [
+	    {"type": "work", "value": "tel:+1.919.555.9515"},
+	    {"type": "fax", "value": "tel:+1.919.555.9564"}
+	],     
+	"emails": [
+            {"type": "work", "value": "mailto:jlambda@example.com", "pref": true},
+            {"type": "home", "value": "mailto:jlambda@example.net"}
+	],
+	"addresses": [
+            {"type": "work",
+             "pref": false,
+             "formatted": "2225 Acme Drive\n27613-3502 Raleigh, NC\nU.S.A.",
+	     "streetAddress": "2225 Acme Drive",
+	     "locality": "Raleigh",
+	     "region": "NC",
+	     "postalCode": "27613-3502",
+	     "country": "U.S.A."
+	    }
+	], 
+	"ims": null,
+	"organizations": [{"name": "ACME Inc."}],
+	"revision": null, 
+	"birthday": null,
+	"gender": null,
+	"note": null, 
+	"photos": null,
+        "categories": null, 
+	"urls": [{value: "http://example.net/~jlambda/"}], 
+	"timezone": null
+};
+
+
+     navigator.contacts.find(["id", "displayName", "name", "nickname", "phoneNumbers", "emails", "addresses", "ims", "organizations", "revision", "birthday", "gender", "note", "photos", "categories", "urls", "timezone"], function (contacts) {
+         t.step(function () {
+           assert_is_contact(contacts[0]);
+           assert_contact_same_as(contacts[0], joeContact);
+           t.done();
+         });
+     });
+  </script>
+ </body>
+</html>