toolkit/components/microformats/tests/test_Microformats_hCalendar.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <html>
michael@0 2 <head>
michael@0 3 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
michael@0 4 <title>Testing Microformats.js (hCalendar)</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 <div id="content" style="display: none">
michael@0 11
michael@0 12 From http://hg.microformats.org/tests
michael@0 13
michael@0 14 <div class="vevent" id="01-component-vevent-dtstart-date">
michael@0 15 <div>Dates: <abbr class="dtstart" title="19970903">September 3, 1997</abbr></div>
michael@0 16 </div>
michael@0 17
michael@0 18 <div class="vevent" id="02-component-vevent-dtstart-datetime">
michael@0 19 <div>Dates: <abbr class="dtstart" title="19970903T163000Z">September 3, 1997, 16:30</abbr></div>
michael@0 20 </div>
michael@0 21
michael@0 22 <div class="vevent" id="03-component-vevent-dtend-date">
michael@0 23 <div>Dates: <abbr class="dtstart" title="19970903">September 3, 1997</abbr>
michael@0 24 <abbr class="dtend" title="19970904">( all day )</abbr></div>
michael@0 25 </div>
michael@0 26
michael@0 27 <div class="vevent" id="04-component-vevent-dtend-datetime">
michael@0 28 <div>Date: <abbr class="dtstart" title="19970903T160000Z">September 3, 1997 at 4pm</abbr>
michael@0 29 <abbr class="dtend" title="19970903T180000Z"> for 2 hours.</abbr></div>
michael@0 30 </div>
michael@0 31
michael@0 32 <div class="vcalendar">
michael@0 33 <span class="vevent" id="05-calendar-simple">
michael@0 34 <a class="url" href="http://www.web2con.com/">
michael@0 35 <span class="summary">Web 2.0 Conference</span>:
michael@0 36 <abbr class="dtstart" title="2005-10-05">October 5</abbr>-
michael@0 37 <abbr class="dtend" title="2005-10-08">7</abbr>,
michael@0 38 at the <span class="location">Argent Hotel, San Francisco, CA</span>
michael@0 39 </a>
michael@0 40 </span>
michael@0 41 </div>
michael@0 42
michael@0 43 <p class="vevent" id="06-component-vevent-uri-relative">
michael@0 44 <a class="url summary" href="/squidlist/calendar/12279/2006/1/15">Bad Movie Night - Gigli (blame mike spiegelman)</a>
michael@0 45 <br />
michael@0 46 <abbr class="dtstart" title="20060115T000000">Sun, Jan 15 : 8pm</abbr>
michael@0 47 <br />
michael@0 48 </p>
michael@0 49
michael@0 50 <div class="vevent" id="07-component-vevent-description-simple">
michael@0 51 <div class="description">Project xyz Review Meeting Minutes</div>
michael@0 52 </div>
michael@0 53
michael@0 54 <div class="aaa vevent" id="08-component-vevent-multiple-classes">
michael@0 55 <a class="bbb url" href="http://www.web2con.com/">
michael@0 56 <span class="ccc summary">Web 2.0 Conference</span>:
michael@0 57 <abbr class="ddd dtstart" title="2005-10-05">October 5</abbr>-
michael@0 58 <abbr class="eee dtend" title="2005-10-08">7</abbr>,
michael@0 59 at the <span class="fff location">Argent Hotel, San Francisco, CA</span>
michael@0 60 </a>
michael@0 61 </div>
michael@0 62
michael@0 63 <ul>
michael@0 64 <li class="vevent" id="09-component-vevent-summary-in-img-alt">
michael@0 65 <a class="url" href="http://conferences.oreillynet.com/et2006/">
michael@0 66 <img style="display:block" class="summary"
michael@0 67 src="http://mochi.test:8888/tests/browser/microformats/test/picture.png"
michael@0 68 alt="O'Reilly Emerging Technology Conference" />
michael@0 69 <abbr class="dtstart" title="20060306">
michael@0 70 3/6</abbr>-<abbr class="dtend" title="20060310">9</abbr>
michael@0 71 @
michael@0 72 <span class="location">
michael@0 73 Manchester Grand Hyatt in San Diego, CA
michael@0 74 </span>
michael@0 75 </a>
michael@0 76 </li>
michael@0 77 </ul>
michael@0 78
michael@0 79 <div class="vcalendar">
michael@0 80 <div class="vevent" id="10-component-vevent-entity">
michael@0 81 <div class="summary">Cricket &amp; Tennis Centre</div>
michael@0 82 <div class="description">Melbourne&apos;s Cricket &amp; Tennis Centres are in the heart of the city</div>
michael@0 83 </div>
michael@0 84 </div>
michael@0 85
michael@0 86 <p class="schedule vevent" id="11-component-vevent-summary-in-subelements">
michael@0 87 <span class="summary">
michael@0 88 <span style="font-weight:bold; color: #3E4876;">Welcome!</span>
michael@0 89 <a href="/cs/web2005/view/e_spkr/1852">John Battelle</a>,
michael@0 90 <a href="/cs/web2005/view/e_spkr/416">Tim O'Reilly</a>
michael@0 91 </span>
michael@0 92 <br />
michael@0 93 <b>Time:</b>
michael@0 94 <abbr class="dtstart" title="20051005T1630-0700">4:30pm</abbr>-
michael@0 95 <abbr class="dtend" title="20051005T1645-0700">4:45pm
michael@0 96 </abbr>
michael@0 97 </p>
michael@0 98
michael@0 99 <p class="vevent" id="12-component-vevent-summary-url-in-same-class">
michael@0 100 <a class="url summary" href="http://www.laughingsquid.com/squidlist/calendar/12377/2006/1/25">Art Reception for Tom Schultz and Felix Macnee</a>
michael@0 101 <br />
michael@0 102 <abbr class="dtstart" title="20060125T000000">Wed, Jan 25 : 6:00 pm - 9:00 pm</abbr>
michael@0 103 <br />
michael@0 104 </p>
michael@0 105
michael@0 106 <div class="vcalendar">
michael@0 107 <div class="vevent" id="13-component-vevent-summary-url-property">
michael@0 108 <span class="summary">
michael@0 109 <a class="url" href="http://dps1.travelocity.com/dparcobrand.ctl?smls=Y&amp;Service=YHOE&amp;.intl=us&amp;aln_name=AA&amp;flt_num=1655&amp;dep_arp_name=&amp;arr_arp_name=&amp;dep_dt_dy_1=23&amp;dep_dt_mn_1=Jan&amp;dep_dt_yr_1=2006&amp;dep_tm_1=9:00am">ORD-SFO/AA 1655</a>
michael@0 110 </span>
michael@0 111 </div>
michael@0 112 </div>
michael@0 113
michael@0 114 <div class="vcalendar">
michael@0 115 <span class="vevent" id="15-calendar-xml-lang">
michael@0 116 <a class="url" href="http://www.web2con.com/">
michael@0 117 <span class="summary">Web 2.0 Conference</span>:
michael@0 118 <abbr class="dtstart" title="2005-10-05">October 5</abbr>-
michael@0 119 <abbr class="dtend" title="2005-10-08">7</abbr>,
michael@0 120 at the <span class="location">Argent Hotel, San Francisco, CA</span>
michael@0 121 </a>
michael@0 122 </span>
michael@0 123 </div>
michael@0 124
michael@0 125 <div class="vcalendar">
michael@0 126 <span class="vevent" id="16-calendar-force-outlook">
michael@0 127 <a class="url" href="http://www.web2con.com/">
michael@0 128 <abbr class="dtstart" title="2005-10-05">October 5</abbr>-
michael@0 129 <abbr class="dtend" title="2005-10-08">7</abbr>,
michael@0 130 at the <span class="location">Argent Hotel, San Francisco, CA</span>
michael@0 131 </a>
michael@0 132 </span>
michael@0 133 </div>
michael@0 134
michael@0 135 <p class="vevent" id="17-component-vevent-description-value-in-subelements">
michael@0 136 <span class="description">
michael@0 137 RESOLUTION: to have a
michael@0 138 <b class="summary">3rd PAW ftf meeting</b>
michael@0 139 <abbr class="dtstart" title="2006-01-18">18</abbr>-<abbr class="dtend" title="2006-01-20">19 Jan</abbr> in
michael@0 140 <em class="location">Maryland</em>; location contingent on confirmation from timbl</span>
michael@0 141 </p>
michael@0 142
michael@0 143 <div class="vevent" id="18-component-vevent-uid.1">
michael@0 144 <div>UID: <span class="uid">http://example.com/foo.html</span></div>
michael@0 145 </div>
michael@0 146 <div class="vevent" id="18-component-vevent-uid.2">
michael@0 147 UID: <a class="uid" href="http://example.com/foo.html">another hcal event</a>
michael@0 148 </div>
michael@0 149
michael@0 150 <div class="vevent" id="18-component-vevent-uid.3">
michael@0 151 UID: <object class="uid" data="http://example.com/foo.html">another hcal event</object>
michael@0 152 </div>
michael@0 153
michael@0 154 <div class="vevent" id="18-component-vevent-uid.4">
michael@0 155 UID: <map id="foo"><area alt="uid" class="uid" href="http://example.com/foo.html" /></map>
michael@0 156 </div>
michael@0 157
michael@0 158 <div class="vevent" id="18-component-vevent-uid.5">
michael@0 159 UID: <img class="uid" alt="uid" src="http://example.com/foo.html" />
michael@0 160 </div>
michael@0 161
michael@0 162 <div class="vcalendar">
michael@0 163 <div class="vevent" id="19-calendar-attachments">
michael@0 164 <div>Start Time: <abbr class="dtstart" title="19970324T123000Z">March 24, 1997 12:30 UTC</abbr></div>
michael@0 165 <div class="summary">Calendaring Interoperability Planning Meeting</div>
michael@0 166
michael@0 167 <div>Attachments:
michael@0 168 <ul>
michael@0 169 <li><a class="attach" href="http://microformats.org/img/logo.gif">microformats logo</a></li>
michael@0 170 <li><a class="attach" type="application/postscript" href="ftp://xyzCorp.com/pub/conf/bkgrnd.ps">ftp://xyzCorp.com/pub/conf/bkgrnd.ps</a></li>
michael@0 171 </ul>
michael@0 172 </div>
michael@0 173 </div>
michael@0 174 </div>
michael@0 175
michael@0 176 <div class="vevent" id="empty-description">
michael@0 177 <span class="description"></span>
michael@0 178 </div>
michael@0 179
michael@0 180
michael@0 181 </div>
michael@0 182
michael@0 183 <pre id="test">
michael@0 184 <script class="testbody" type="text/javascript">
michael@0 185
michael@0 186 test_Microformats();
michael@0 187 test_hCard();
michael@0 188
michael@0 189 function test_Microformats() {
michael@0 190 var Microformats = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").Microformats;
michael@0 191
michael@0 192 ok(Microformats, "Check global access to Microformats");
michael@0 193 };
michael@0 194
michael@0 195 function test_hCard() {
michael@0 196 var hCalendar = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").hCalendar;
michael@0 197
michael@0 198 var hcalendar;
michael@0 199
michael@0 200 hcalendar = new hCalendar(document.getElementById("01-component-vevent-dtstart-date"));
michael@0 201
michael@0 202 is(hcalendar.dtstart, "1997-09-03", "01-component-vevent-dtstart-date - dtstart");
michael@0 203
michael@0 204 hcalendar = new hCalendar(document.getElementById("02-component-vevent-dtstart-datetime"));
michael@0 205
michael@0 206 is(hcalendar.dtstart, "1997-09-03T16:30:00Z", "02-component-vevent-dtstart-datetime - dtstart");
michael@0 207
michael@0 208 hcalendar = new hCalendar(document.getElementById("03-component-vevent-dtend-date"));
michael@0 209
michael@0 210 is(hcalendar.dtstart, "1997-09-03", "03-component-vevent-dtend-date - dtstart");
michael@0 211 is(hcalendar.dtend, "1997-09-04", "03-component-vevent-dtend-date - dtend");
michael@0 212
michael@0 213
michael@0 214 hcalendar = new hCalendar(document.getElementById("04-component-vevent-dtend-datetime"));
michael@0 215
michael@0 216 is(hcalendar.dtstart, "1997-09-03T16:00:00Z", "04-component-vevent-dtend-datetime - dtstart");
michael@0 217 is(hcalendar.dtend, "1997-09-03T18:00:00Z", "04-component-vevent-dtend-datetime - dtend");
michael@0 218
michael@0 219 hcalendar = new hCalendar(document.getElementById("05-calendar-simple"));
michael@0 220
michael@0 221 is(hcalendar.dtstart, "2005-10-05", "05-calendar-simple - dtstart");
michael@0 222 is(hcalendar.dtend, "2005-10-08", "05-calendar-simple - dtend");
michael@0 223 is(hcalendar.url, "http://www.web2con.com/", "05-calendar-simple - url");
michael@0 224 is(hcalendar.summary, "Web 2.0 Conference", "05-calendar-simple - summary");
michael@0 225 is(hcalendar.location, "Argent Hotel, San Francisco, CA", "05-calendar-simple - location");
michael@0 226
michael@0 227 hcalendar = new hCalendar(document.getElementById("06-component-vevent-uri-relative"));
michael@0 228 is(hcalendar.url, "http://mochi.test:8888/squidlist/calendar/12279/2006/1/15", "06-component-vevent-uri-relative - url");
michael@0 229 is(hcalendar.summary, "Bad Movie Night - Gigli (blame mike spiegelman)", "06-component-vevent-uri-relative - summary");
michael@0 230 is(hcalendar.dtstart, "2006-01-15T00:00:00", "06-component-vevent-uri-relative - dtstart");
michael@0 231
michael@0 232 hcalendar = new hCalendar(document.getElementById("07-component-vevent-description-simple"));
michael@0 233 is(hcalendar.description, "Project xyz Review Meeting Minutes", "07-component-vevent-description-simple - description");
michael@0 234
michael@0 235 hcalendar = new hCalendar(document.getElementById("08-component-vevent-multiple-classes"));
michael@0 236 is(hcalendar.dtstart, "2005-10-05", "08-component-vevent-multiple-classes - dtstart");
michael@0 237 is(hcalendar.dtend, "2005-10-08", "08-component-vevent-multiple-classes - dtend");
michael@0 238 is(hcalendar.url, "http://www.web2con.com/", "08-component-vevent-multiple-classes - url");
michael@0 239 is(hcalendar.summary, "Web 2.0 Conference", "08-component-vevent-multiple-classes - summary");
michael@0 240 is(hcalendar.location, "Argent Hotel, San Francisco, CA", "08-component-vevent-multiple-classes - location");
michael@0 241
michael@0 242 hcalendar = new hCalendar(document.getElementById("09-component-vevent-summary-in-img-alt"));
michael@0 243 is(hcalendar.dtstart, "2006-03-06", "09-component-vevent-summary-in-img-alt - dtstart");
michael@0 244 is(hcalendar.dtend, "2006-03-10", "09-component-vevent-summary-in-img-alt - dtend");
michael@0 245 is(hcalendar.url, "http://conferences.oreillynet.com/et2006/", "09-component-vevent-summary-in-img-alt - url");
michael@0 246 is(hcalendar.summary, "O'Reilly Emerging Technology Conference", "09-component-vevent-summary-in-img-alt - summary");
michael@0 247 is(hcalendar.location, "Manchester Grand Hyatt in San Diego, CA", "09-component-vevent-summary-in-img-alt - location");
michael@0 248
michael@0 249 hcalendar = new hCalendar(document.getElementById("10-component-vevent-entity"));
michael@0 250 is(hcalendar.summary, "Cricket & Tennis Centre", "10-component-vevent-entity - summary");
michael@0 251 is(hcalendar.description, "Melbourne's Cricket & Tennis Centres are in the heart of the city", "10-component-vevent-entity - description");
michael@0 252
michael@0 253 hcalendar = new hCalendar(document.getElementById("11-component-vevent-summary-in-subelements"));
michael@0 254 is(hcalendar.dtstart, "2005-10-05T16:30:00-0700", "11-component-vevent-summary-in-subelements - dtstart");
michael@0 255 is(hcalendar.dtend, "2005-10-05T16:45:00-0700", "11-component-vevent-summary-in-subelements - dtend");
michael@0 256 is(hcalendar.summary, "Welcome! John Battelle, Tim O'Reilly", "11-component-vevent-summary-in-subelements - summary");
michael@0 257
michael@0 258 hcalendar = new hCalendar(document.getElementById("12-component-vevent-summary-url-in-same-class"));
michael@0 259 is(hcalendar.dtstart, "2006-01-25T00:00:00", "12-component-vevent-summary-url-in-same-class - dtstart");
michael@0 260 is(hcalendar.summary, "Art Reception for Tom Schultz and Felix Macnee", "12-component-vevent-summary-url-in-same-class - summary");
michael@0 261 is(hcalendar.url, "http://www.laughingsquid.com/squidlist/calendar/12377/2006/1/25", "12-component-vevent-summary-url-in-same-class - url");
michael@0 262
michael@0 263 hcalendar = new hCalendar(document.getElementById("13-component-vevent-summary-url-property"));
michael@0 264 is(hcalendar.summary, "ORD-SFO/AA 1655", "13-component-vevent-summary-url-property - summary");
michael@0 265 is(hcalendar.url, "http://dps1.travelocity.com/dparcobrand.ctl?smls=Y&Service=YHOE&.intl=us&aln_name=AA&flt_num=1655&dep_arp_name=&arr_arp_name=&dep_dt_dy_1=23&dep_dt_mn_1=Jan&dep_dt_yr_1=2006&dep_tm_1=9:00am", "13-component-vevent-summary-url-property - url");
michael@0 266
michael@0 267 hcalendar = new hCalendar(document.getElementById("15-calendar-xml-lang"));
michael@0 268 is(hcalendar.dtend, "2005-10-08", "15-calendar-xml-lang - dtend");
michael@0 269 is(hcalendar.dtstart, "2005-10-05", "15-calendar-xml-lang - dtstart");
michael@0 270 is(hcalendar.location, "Argent Hotel, San Francisco, CA", "15-calendar-xml-lang - location");
michael@0 271 is(hcalendar.summary, "Web 2.0 Conference", "15-calendar-xml-lang - summary");
michael@0 272 is(hcalendar.url, "http://www.web2con.com/", "15-calendar-xml-lang - url");
michael@0 273
michael@0 274 hcalendar = new hCalendar(document.getElementById("16-calendar-force-outlook"));
michael@0 275 is(hcalendar.dtend, "2005-10-08", "16-calendar-force-outlook - dtend");
michael@0 276 is(hcalendar.dtstart, "2005-10-05", "16-calendar-force-outlook - dtstart");
michael@0 277 is(hcalendar.location, "Argent Hotel, San Francisco, CA", "16-calendar-force-outlook - location");
michael@0 278 is(hcalendar.url, "http://www.web2con.com/", "16-calendar-force-outlook - url");
michael@0 279
michael@0 280 hcalendar = new hCalendar(document.getElementById("17-component-vevent-description-value-in-subelements"));
michael@0 281 is(hcalendar.description, "RESOLUTION: to have a 3rd PAW ftf meeting 18-19 Jan in Maryland; location contingent on confirmation from timbl", "17-component-vevent-description-value-in-subelements - description");
michael@0 282 is(hcalendar.dtstart, "2006-01-18", "17-component-vevent-description-value-in-subelements - dtstart");
michael@0 283 is(hcalendar.dtend, "2006-01-20", "17-component-vevent-description-value-in-subelements - dtend");
michael@0 284 is(hcalendar.location, "Maryland", "17-component-vevent-description-value-in-subelements - location");
michael@0 285 is(hcalendar.summary, "3rd PAW ftf meeting", "17-component-vevent-description-value-in-subelements - summary");
michael@0 286
michael@0 287 hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.1"));
michael@0 288
michael@0 289 hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.2"));
michael@0 290
michael@0 291 hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.3"));
michael@0 292
michael@0 293 hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.4"));
michael@0 294
michael@0 295 hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.5"));
michael@0 296
michael@0 297 hcalendar = new hCalendar(document.getElementById("19-calendar-attachments"));
michael@0 298
michael@0 299 hcalendar = new hCalendar(document.getElementById("empty-description"));
michael@0 300 is (hcalendar.description, "", "Empty description");
michael@0 301 }
michael@0 302
michael@0 303 </script>
michael@0 304 </pre>
michael@0 305 </body>
michael@0 306 </html>

mercurial