Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <html>
2 <head>
3 <title>Testing Mixed Up Microformat APIs</title>
4 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
5 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
7 </head>
8 <body id="contentbody">
9 <pre id="test">
10 <script class="testbody" type="text/javascript">
12 // Called from onload in iframe
13 function test_MicroformatsAPI() {
14 var Microformats = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").Microformats;
16 // Test that we can get them all
17 var mfs = [];
18 mfs = Microformats.get("adr",
19 document.getElementById("content"),
20 {showHidden: true});
22 is(mfs.length, 2, "Two adr's in our array");
24 mfs = Microformats.get("geo",
25 document.getElementById("content"),
26 {recurseExternalFrames: true});
27 is(mfs.length, 3, "Three geo's in our array");
29 mfs = Microformats.get("hCalendar",
30 document.getElementById("content"),
31 {recurseExternalFrames: false});
32 // Should get the hCalendar whether we recurseExternalFrames or not.
33 is(mfs.length, 2, "Two hCalendar returned not recursing frames");
35 mfs = Microformats.get("hCalendar",
36 document.getElementById("content"),
37 {recurseExternalFrames: true});
38 is(mfs.length, 2, "Two hCalendars returned recursing frames");
40 mfs = Microformats.get("hCard",
41 document.getElementById("content"),
42 {recurseExternalFrames: true},
43 mfs);
44 is(mfs.length, 3, "Two hCalendars and one hCard");
46 mfs = Microformats.get("hCalendar", document.getElementById("secondnode"));
48 is(mfs[0].summary, "Pseudo Conference",
49 "Make sure we get the proper hCalendar from the second level node");
50 is(mfs.length, 1, "And we should only get one hCalendar not two from this node.");
51 }
52 </script>
53 </pre>
54 <div id="content">
55 <!-- hCard -->
56 <p class="vcard" id="23-abbr-title-everything">
57 <!-- perhaps the most annoying test ever -->
58 <abbr class="fn" title="John Doe">foo</abbr>
59 <span class="n">
60 <abbr class="honorific-prefix" title="Mister">Mr.</abbr>
61 <abbr class="given-name" title="Jonathan">John</abbr>
62 <abbr class="additional-name" title="John">J</abbr>
63 <abbr class="family-name" title="Doe-Smith">Doe</abbr>
64 <abbr class="honorific-suffix" title="Medical Doctor">M.D</abbr>
65 </span>
66 <abbr class="nickname" title="JJ">jj</abbr>
67 <abbr class="bday" title="2006-04-04">April 4, 2006</abbr>
68 <span class="adr">
69 <abbr class="post-office-box" title="Box 1234">B. 1234</abbr>
70 <abbr class="extended-address" title="Suite 100">Ste. 100</abbr>
71 <abbr class="street-address" title="123 Fake Street">123 Fake St.</abbr>
72 <abbr class="locality" title="San Francisco">San Fran</abbr>
73 <abbr class="region" title="California">CA</abbr>
74 <abbr class="postal-code" title="12345-6789">12345</abbr>
75 <abbr class="country-name" title="United States of America">USA</abbr>
76 <abbr class="type" title="work">workplace</abbr>
77 </span>
78 <abbr class="tel" title="415.555.1234">1234</abbr>
79 <abbr class="tel-type-value" title="work">workplace</abbr>
80 <!-- mailer -->
81 <abbr class="tz" title="-0700">Pacific Time</abbr>
82 <span class="geo">
83 <abbr class="latitude" title="37.77">Northern</abbr>
84 <abbr class="longitude" title="-122.41">California</abbr>
85 </span>
86 <abbr class="title" title="President">pres.</abbr> and
87 <abbr class="role" title="Chief">cat wrangler</abbr>
88 <!-- <span class="agent"></span> -->
89 <span class="org">
90 <abbr class="organization-name" title="Intellicorp">foo</abbr>
91 <abbr class="organization-unit" title="Intelligence">bar</abbr>
92 </span>
93 <!-- <abbr class="category" title=""></abbr> -->
94 <abbr class="note" title="this is a note">this is not a note</abbr>
95 <!-- <abbr class="rev" title=""></abbr> (revision datetime) -->
96 <!-- <abbr class="sort-string" title=""></abbr> -->
97 <abbr class="uid" title="abcdefghijklmnopqrstuvwxyz">alpha</abbr>
98 <abbr class="class" title="public">pub</abbr>
99 <!-- <abbr class="key" title=""></abbr> -->
100 </p>
102 <!-- hCalendar -->
103 <frameset>
104 <frame id="frame1">
105 <div>
106 <span class="notAMicroformat" id="notme">
107 <abbr> class="foo">I am not a microformat</abbr>
108 <abbr> class="title">Foolish title, not a format</abbr>
109 </span>
110 </div>
111 </frame>
112 <frame id="frame3">
113 <span class="geo" id="02-geo-abbr-latlong" >
114 <abbr class="latitude" title="75.77">Far Northern</abbr>
115 <abbr class="longitude" title="-122.41">Canada</abbr>
116 </span>
117 <frame id="frame2">
118 <div class="vcalendar">
119 <span class="vevent" id="15-calendar-xml-lang">
120 <a class="url" href="http://www.web2con.com/">
121 <span class="summary">Web 2.0 Conference</span>:
122 <abbr class="dtstart" title="2005-10-05">October 5</abbr>-
123 <abbr class="dtend" title="2005-10-08">7</abbr>,
124 at the <span class="location">Argent Hotel, San Francisco, CA</span>
125 </a>
126 </span>
127 </div>
128 </frame>
129 </frameset>
131 <div id="secondnode">
132 <span>some interesting content</span>
134 <!-- Geo Fire test once we know this is loaded.-->
135 <iframe src="geo.html" onload="test_MicroformatsAPI();">
136 </iframe>
138 <!-- adr -->
139 <div class="adr" id="01-extended-address">
140 <span class="extended-address">Park Bench</span>
141 </div>
143 <div class="vcalendar">
144 <span class="vevent" id="16-calendar-xml-lang">
145 <a class="url" href="http://www.foo.com/">
146 <span class="summary">Pseudo Conference</span>:
147 <abbr class="dtstart" title="2008-04-01">April 1</abbr>-
148 <abbr class="dtend" title="2008-04-03">April 3</abbr>,
149 at the <span class="location">Argent Hotel, San Francisco, CA</span>
150 </a>
151 </span>
152 </div>
153 </div>
154 </div>
155 </body>
156 </html>