toolkit/components/microformats/tests/test_Microformats_hCalendar.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/microformats/tests/test_Microformats_hCalendar.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,306 @@
     1.4 +<html>
     1.5 +<head>
     1.6 +  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
     1.7 +  <title>Testing Microformats.js (hCalendar)</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.10 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
    1.11 +</head>
    1.12 +<body>
    1.13 +<div id="content" style="display: none">
    1.14 +
    1.15 +  From http://hg.microformats.org/tests
    1.16 +
    1.17 +  <div class="vevent" id="01-component-vevent-dtstart-date">
    1.18 +    <div>Dates: <abbr class="dtstart" title="19970903">September 3, 1997</abbr></div>
    1.19 +  </div>
    1.20 +
    1.21 +  <div class="vevent" id="02-component-vevent-dtstart-datetime">
    1.22 +    <div>Dates: <abbr class="dtstart" title="19970903T163000Z">September 3, 1997, 16:30</abbr></div>
    1.23 +  </div>
    1.24 +
    1.25 +  <div class="vevent" id="03-component-vevent-dtend-date">
    1.26 +    <div>Dates: <abbr class="dtstart" title="19970903">September 3, 1997</abbr>
    1.27 +    <abbr class="dtend" title="19970904">( all day )</abbr></div>
    1.28 +  </div>
    1.29 +
    1.30 +  <div class="vevent" id="04-component-vevent-dtend-datetime">
    1.31 +    <div>Date: <abbr class="dtstart" title="19970903T160000Z">September 3, 1997 at 4pm</abbr>
    1.32 +    <abbr class="dtend" title="19970903T180000Z"> for 2 hours.</abbr></div>
    1.33 +  </div>
    1.34 +
    1.35 +  <div class="vcalendar">
    1.36 +    <span class="vevent" id="05-calendar-simple">
    1.37 +      <a class="url" href="http://www.web2con.com/">
    1.38 +        <span class="summary">Web 2.0 Conference</span>: 
    1.39 +        <abbr class="dtstart" title="2005-10-05">October 5</abbr>-
    1.40 +        <abbr class="dtend" title="2005-10-08">7</abbr>,
    1.41 +        at the <span class="location">Argent Hotel, San Francisco, CA</span>
    1.42 +      </a>
    1.43 +    </span>
    1.44 +  </div>
    1.45 +
    1.46 +  <p class="vevent" id="06-component-vevent-uri-relative">
    1.47 +    <a class="url summary" href="/squidlist/calendar/12279/2006/1/15">Bad Movie Night - Gigli (blame mike spiegelman)</a>
    1.48 +    <br />
    1.49 +    <abbr class="dtstart" title="20060115T000000">Sun, Jan 15 : 8pm</abbr>
    1.50 +    <br />
    1.51 +  </p>
    1.52 +
    1.53 +  <div class="vevent" id="07-component-vevent-description-simple">
    1.54 +    <div class="description">Project xyz Review Meeting Minutes</div>
    1.55 +  </div>
    1.56 +
    1.57 +  <div class="aaa vevent" id="08-component-vevent-multiple-classes">
    1.58 +    <a class="bbb url" href="http://www.web2con.com/">
    1.59 +      <span class="ccc summary">Web 2.0 Conference</span>: 
    1.60 +      <abbr class="ddd dtstart" title="2005-10-05">October 5</abbr>-
    1.61 +      <abbr class="eee dtend" title="2005-10-08">7</abbr>,
    1.62 +      at the <span class="fff location">Argent Hotel, San Francisco, CA</span>
    1.63 +    </a>
    1.64 +  </div>
    1.65 +
    1.66 +  <ul>
    1.67 +    <li class="vevent" id="09-component-vevent-summary-in-img-alt">
    1.68 +     <a class="url" href="http://conferences.oreillynet.com/et2006/">
    1.69 +      <img style="display:block" class="summary" 
    1.70 +       src="http://mochi.test:8888/tests/browser/microformats/test/picture.png"
    1.71 +       alt="O'Reilly Emerging Technology Conference" />
    1.72 +      <abbr class="dtstart" title="20060306">
    1.73 +        3/6</abbr>-<abbr class="dtend" title="20060310">9</abbr>
    1.74 +      @
    1.75 +      <span class="location">
    1.76 +         Manchester Grand Hyatt in San Diego, CA
    1.77 +       </span>
    1.78 +     </a>
    1.79 +    </li>
    1.80 +  </ul>
    1.81 +
    1.82 +  <div class="vcalendar">
    1.83 +    <div class="vevent" id="10-component-vevent-entity">
    1.84 +      <div class="summary">Cricket &amp; Tennis Centre</div>
    1.85 +      <div class="description">Melbourne&apos;s Cricket &amp; Tennis Centres are in the heart of the city</div>
    1.86 +    </div>
    1.87 +  </div>
    1.88 +
    1.89 +  <p class="schedule vevent" id="11-component-vevent-summary-in-subelements">
    1.90 +    <span class="summary">
    1.91 +      <span style="font-weight:bold; color: #3E4876;">Welcome!</span>
    1.92 +      <a href="/cs/web2005/view/e_spkr/1852">John Battelle</a>,
    1.93 +      <a href="/cs/web2005/view/e_spkr/416">Tim O'Reilly</a>
    1.94 +    </span>
    1.95 +    <br />
    1.96 +    <b>Time:</b>
    1.97 +    <abbr class="dtstart" title="20051005T1630-0700">4:30pm</abbr>-
    1.98 +    <abbr class="dtend" title="20051005T1645-0700">4:45pm
    1.99 +    </abbr>
   1.100 +  </p>
   1.101 +
   1.102 +  <p class="vevent" id="12-component-vevent-summary-url-in-same-class">
   1.103 +    <a class="url summary" href="http://www.laughingsquid.com/squidlist/calendar/12377/2006/1/25">Art Reception for Tom Schultz and Felix Macnee</a>
   1.104 +    <br />
   1.105 +    <abbr class="dtstart" title="20060125T000000">Wed, Jan 25 : 6:00 pm - 9:00 pm</abbr>
   1.106 +    <br />
   1.107 +  </p>
   1.108 +
   1.109 +  <div class="vcalendar">
   1.110 +    <div class="vevent" id="13-component-vevent-summary-url-property">
   1.111 +      <span class="summary">
   1.112 +        <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>
   1.113 +      </span>
   1.114 +    </div>
   1.115 +  </div>
   1.116 +
   1.117 +  <div class="vcalendar">
   1.118 +    <span class="vevent" id="15-calendar-xml-lang">
   1.119 +      <a class="url" href="http://www.web2con.com/">
   1.120 +      <span class="summary">Web 2.0 Conference</span>: 
   1.121 +      <abbr class="dtstart" title="2005-10-05">October 5</abbr>-
   1.122 +      <abbr class="dtend" title="2005-10-08">7</abbr>,
   1.123 +      at the <span class="location">Argent Hotel, San Francisco, CA</span>
   1.124 +      </a>
   1.125 +    </span>
   1.126 +  </div>
   1.127 +
   1.128 +    <div class="vcalendar">
   1.129 +      <span class="vevent" id="16-calendar-force-outlook">
   1.130 +        <a class="url" href="http://www.web2con.com/">
   1.131 +          <abbr class="dtstart" title="2005-10-05">October 5</abbr>-
   1.132 +          <abbr class="dtend" title="2005-10-08">7</abbr>,
   1.133 +          at the <span class="location">Argent Hotel, San Francisco, CA</span>
   1.134 +        </a>
   1.135 +      </span>
   1.136 +    </div>
   1.137 +
   1.138 +  <p class="vevent" id="17-component-vevent-description-value-in-subelements">
   1.139 +    <span class="description">
   1.140 +      RESOLUTION: to have a
   1.141 +      <b class="summary">3rd PAW ftf meeting</b> 
   1.142 +      <abbr class="dtstart" title="2006-01-18">18</abbr>-<abbr class="dtend" title="2006-01-20">19 Jan</abbr> in 
   1.143 +      <em class="location">Maryland</em>; location contingent on confirmation from timbl</span>
   1.144 +  </p>
   1.145 +
   1.146 +  <div class="vevent" id="18-component-vevent-uid.1">
   1.147 +    <div>UID: <span class="uid">http://example.com/foo.html</span></div>
   1.148 +  </div>
   1.149 +  <div class="vevent" id="18-component-vevent-uid.2">
   1.150 +    UID: <a class="uid" href="http://example.com/foo.html">another hcal event</a>
   1.151 +  </div>
   1.152 +  
   1.153 +  <div class="vevent" id="18-component-vevent-uid.3">
   1.154 +    UID: <object class="uid" data="http://example.com/foo.html">another hcal event</object>
   1.155 +  </div>
   1.156 +  
   1.157 +  <div class="vevent" id="18-component-vevent-uid.4">
   1.158 +    UID: <map id="foo"><area alt="uid" class="uid" href="http://example.com/foo.html" /></map>
   1.159 +  </div>
   1.160 +  
   1.161 +  <div class="vevent" id="18-component-vevent-uid.5">
   1.162 +    UID: <img class="uid" alt="uid" src="http://example.com/foo.html" />
   1.163 +  </div>
   1.164 +
   1.165 +  <div class="vcalendar">
   1.166 +    <div class="vevent" id="19-calendar-attachments">
   1.167 +      <div>Start Time: <abbr class="dtstart" title="19970324T123000Z">March 24, 1997 12:30 UTC</abbr></div>
   1.168 +      <div class="summary">Calendaring Interoperability Planning Meeting</div>
   1.169 +      
   1.170 +      <div>Attachments: 
   1.171 +          <ul>
   1.172 +              <li><a class="attach" href="http://microformats.org/img/logo.gif">microformats logo</a></li>
   1.173 +              <li><a class="attach" type="application/postscript" href="ftp://xyzCorp.com/pub/conf/bkgrnd.ps">ftp://xyzCorp.com/pub/conf/bkgrnd.ps</a></li>
   1.174 +          </ul>
   1.175 +      </div>
   1.176 +    </div>
   1.177 +  </div>
   1.178 +
   1.179 +  <div class="vevent" id="empty-description">
   1.180 +    <span class="description"></span>
   1.181 +  </div>
   1.182 +
   1.183 +
   1.184 +</div>
   1.185 +
   1.186 +<pre id="test">
   1.187 +<script class="testbody" type="text/javascript">
   1.188 +
   1.189 +test_Microformats();
   1.190 +test_hCard();
   1.191 +
   1.192 +function test_Microformats() {
   1.193 +  var Microformats = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").Microformats;
   1.194 +
   1.195 +  ok(Microformats, "Check global access to Microformats");
   1.196 +};
   1.197 +
   1.198 +function test_hCard() {
   1.199 +  var hCalendar = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").hCalendar;
   1.200 +
   1.201 +  var hcalendar;
   1.202 +
   1.203 +  hcalendar = new hCalendar(document.getElementById("01-component-vevent-dtstart-date"));
   1.204 +
   1.205 +  is(hcalendar.dtstart, "1997-09-03", "01-component-vevent-dtstart-date - dtstart");
   1.206 +
   1.207 +  hcalendar = new hCalendar(document.getElementById("02-component-vevent-dtstart-datetime"));
   1.208 +
   1.209 +  is(hcalendar.dtstart, "1997-09-03T16:30:00Z", "02-component-vevent-dtstart-datetime - dtstart");
   1.210 +
   1.211 +  hcalendar = new hCalendar(document.getElementById("03-component-vevent-dtend-date"));
   1.212 +
   1.213 +  is(hcalendar.dtstart, "1997-09-03", "03-component-vevent-dtend-date - dtstart");
   1.214 +  is(hcalendar.dtend, "1997-09-04", "03-component-vevent-dtend-date - dtend");
   1.215 +
   1.216 +
   1.217 +  hcalendar = new hCalendar(document.getElementById("04-component-vevent-dtend-datetime"));
   1.218 +
   1.219 +  is(hcalendar.dtstart, "1997-09-03T16:00:00Z", "04-component-vevent-dtend-datetime - dtstart");
   1.220 +  is(hcalendar.dtend, "1997-09-03T18:00:00Z", "04-component-vevent-dtend-datetime - dtend");
   1.221 +
   1.222 +  hcalendar = new hCalendar(document.getElementById("05-calendar-simple"));
   1.223 +
   1.224 +  is(hcalendar.dtstart, "2005-10-05", "05-calendar-simple - dtstart");
   1.225 +  is(hcalendar.dtend, "2005-10-08", "05-calendar-simple - dtend");
   1.226 +  is(hcalendar.url, "http://www.web2con.com/", "05-calendar-simple - url");
   1.227 +  is(hcalendar.summary, "Web 2.0 Conference", "05-calendar-simple - summary");
   1.228 +  is(hcalendar.location, "Argent Hotel, San Francisco, CA", "05-calendar-simple - location");
   1.229 +
   1.230 +  hcalendar = new hCalendar(document.getElementById("06-component-vevent-uri-relative"));
   1.231 +  is(hcalendar.url, "http://mochi.test:8888/squidlist/calendar/12279/2006/1/15", "06-component-vevent-uri-relative - url");
   1.232 +  is(hcalendar.summary, "Bad Movie Night - Gigli (blame mike spiegelman)", "06-component-vevent-uri-relative - summary");
   1.233 +  is(hcalendar.dtstart, "2006-01-15T00:00:00", "06-component-vevent-uri-relative - dtstart");
   1.234 +
   1.235 +  hcalendar = new hCalendar(document.getElementById("07-component-vevent-description-simple"));
   1.236 +  is(hcalendar.description, "Project xyz Review Meeting Minutes", "07-component-vevent-description-simple - description");
   1.237 +
   1.238 +  hcalendar = new hCalendar(document.getElementById("08-component-vevent-multiple-classes"));
   1.239 +  is(hcalendar.dtstart, "2005-10-05", "08-component-vevent-multiple-classes - dtstart");
   1.240 +  is(hcalendar.dtend, "2005-10-08", "08-component-vevent-multiple-classes - dtend");
   1.241 +  is(hcalendar.url, "http://www.web2con.com/", "08-component-vevent-multiple-classes - url");
   1.242 +  is(hcalendar.summary, "Web 2.0 Conference", "08-component-vevent-multiple-classes - summary");
   1.243 +  is(hcalendar.location, "Argent Hotel, San Francisco, CA", "08-component-vevent-multiple-classes - location");
   1.244 +
   1.245 +  hcalendar = new hCalendar(document.getElementById("09-component-vevent-summary-in-img-alt"));
   1.246 +  is(hcalendar.dtstart, "2006-03-06", "09-component-vevent-summary-in-img-alt - dtstart");
   1.247 +  is(hcalendar.dtend, "2006-03-10", "09-component-vevent-summary-in-img-alt - dtend");
   1.248 +  is(hcalendar.url, "http://conferences.oreillynet.com/et2006/", "09-component-vevent-summary-in-img-alt - url");
   1.249 +  is(hcalendar.summary, "O'Reilly Emerging Technology Conference", "09-component-vevent-summary-in-img-alt - summary");
   1.250 +  is(hcalendar.location, "Manchester Grand Hyatt in San Diego, CA", "09-component-vevent-summary-in-img-alt - location");
   1.251 +
   1.252 +  hcalendar = new hCalendar(document.getElementById("10-component-vevent-entity"));
   1.253 +  is(hcalendar.summary, "Cricket & Tennis Centre", "10-component-vevent-entity - summary");
   1.254 +  is(hcalendar.description, "Melbourne's Cricket & Tennis Centres are in the heart of the city", "10-component-vevent-entity - description");
   1.255 +
   1.256 +  hcalendar = new hCalendar(document.getElementById("11-component-vevent-summary-in-subelements"));
   1.257 +  is(hcalendar.dtstart, "2005-10-05T16:30:00-0700", "11-component-vevent-summary-in-subelements - dtstart");
   1.258 +  is(hcalendar.dtend, "2005-10-05T16:45:00-0700", "11-component-vevent-summary-in-subelements - dtend");
   1.259 +  is(hcalendar.summary, "Welcome! John Battelle, Tim O'Reilly", "11-component-vevent-summary-in-subelements - summary");
   1.260 +
   1.261 +  hcalendar = new hCalendar(document.getElementById("12-component-vevent-summary-url-in-same-class"));
   1.262 +  is(hcalendar.dtstart, "2006-01-25T00:00:00", "12-component-vevent-summary-url-in-same-class - dtstart");
   1.263 +  is(hcalendar.summary, "Art Reception for Tom Schultz and Felix Macnee", "12-component-vevent-summary-url-in-same-class - summary");
   1.264 +  is(hcalendar.url, "http://www.laughingsquid.com/squidlist/calendar/12377/2006/1/25", "12-component-vevent-summary-url-in-same-class - url");
   1.265 +
   1.266 +  hcalendar = new hCalendar(document.getElementById("13-component-vevent-summary-url-property"));
   1.267 +  is(hcalendar.summary, "ORD-SFO/AA 1655", "13-component-vevent-summary-url-property - summary");
   1.268 +  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");
   1.269 +
   1.270 +  hcalendar = new hCalendar(document.getElementById("15-calendar-xml-lang"));
   1.271 +  is(hcalendar.dtend, "2005-10-08", "15-calendar-xml-lang - dtend");
   1.272 +  is(hcalendar.dtstart, "2005-10-05", "15-calendar-xml-lang - dtstart");
   1.273 +  is(hcalendar.location, "Argent Hotel, San Francisco, CA", "15-calendar-xml-lang - location");
   1.274 +  is(hcalendar.summary, "Web 2.0 Conference", "15-calendar-xml-lang - summary");
   1.275 +  is(hcalendar.url, "http://www.web2con.com/", "15-calendar-xml-lang - url");
   1.276 +
   1.277 +  hcalendar = new hCalendar(document.getElementById("16-calendar-force-outlook"));
   1.278 +  is(hcalendar.dtend, "2005-10-08", "16-calendar-force-outlook - dtend");
   1.279 +  is(hcalendar.dtstart, "2005-10-05", "16-calendar-force-outlook - dtstart");
   1.280 +  is(hcalendar.location, "Argent Hotel, San Francisco, CA", "16-calendar-force-outlook - location");
   1.281 +  is(hcalendar.url, "http://www.web2con.com/", "16-calendar-force-outlook - url");
   1.282 +
   1.283 +  hcalendar = new hCalendar(document.getElementById("17-component-vevent-description-value-in-subelements"));
   1.284 +  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");
   1.285 +  is(hcalendar.dtstart, "2006-01-18", "17-component-vevent-description-value-in-subelements - dtstart");
   1.286 +  is(hcalendar.dtend, "2006-01-20", "17-component-vevent-description-value-in-subelements - dtend");
   1.287 +  is(hcalendar.location, "Maryland", "17-component-vevent-description-value-in-subelements - location");
   1.288 +  is(hcalendar.summary, "3rd PAW ftf meeting", "17-component-vevent-description-value-in-subelements - summary");
   1.289 +
   1.290 +  hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.1"));
   1.291 +
   1.292 +  hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.2"));
   1.293 +
   1.294 +  hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.3"));
   1.295 +
   1.296 +  hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.4"));
   1.297 +
   1.298 +  hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.5"));
   1.299 +
   1.300 +  hcalendar = new hCalendar(document.getElementById("19-calendar-attachments"));
   1.301 +
   1.302 +  hcalendar = new hCalendar(document.getElementById("empty-description"));
   1.303 +  is (hcalendar.description, "", "Empty description");
   1.304 +}
   1.305 +
   1.306 +</script>
   1.307 +</pre>
   1.308 +</body>
   1.309 +</html>

mercurial