2007-09-20 11:07:13 -07:00
< html >
< head >
< meta http-equiv = "Content-type" content = "text/html; charset=utf-8" / >
< title > Testing Microformats.js (hCalendar)< / title >
2009-05-06 13:46:04 -07:00
< script type = "text/javascript" src = "/MochiKit/packed.js" > < / script >
2007-09-20 11:07:13 -07:00
< script type = "text/javascript" src = "/tests/SimpleTest/SimpleTest.js" > < / script >
< script type = "text/javascript" src = "/tests/SimpleTest/EventUtils.js" > < / script >
< link rel = "stylesheet" type = "text/css" href = "/tests/SimpleTest/test.css" > < / link >
< / head >
< body >
< div id = "content" style = "display: none" >
From http://hg.microformats.org/tests
< div class = "vevent" id = "01-component-vevent-dtstart-date" >
< div > Dates: < abbr class = "dtstart" title = "19970903" > September 3, 1997< / abbr > < / div >
< / div >
< div class = "vevent" id = "02-component-vevent-dtstart-datetime" >
< div > Dates: < abbr class = "dtstart" title = "19970903T163000Z" > September 3, 1997, 16:30< / abbr > < / div >
< / div >
< div class = "vevent" id = "03-component-vevent-dtend-date" >
< div > Dates: < abbr class = "dtstart" title = "19970903" > September 3, 1997< / abbr >
< abbr class = "dtend" title = "19970904" > ( all day )< / abbr > < / div >
< / div >
< div class = "vevent" id = "04-component-vevent-dtend-datetime" >
< div > Date: < abbr class = "dtstart" title = "19970903T160000Z" > September 3, 1997 at 4pm< / abbr >
< abbr class = "dtend" title = "19970903T180000Z" > for 2 hours.< / abbr > < / div >
< / div >
< div class = "vcalendar" >
< span class = "vevent" id = "05-calendar-simple" >
< a class = "url" href = "http://www.web2con.com/" >
< span class = "summary" > Web 2.0 Conference< / span > :
< abbr class = "dtstart" title = "2005-10-05" > October 5< / abbr > -
< abbr class = "dtend" title = "2005-10-08" > 7< / abbr > ,
at the < span class = "location" > Argent Hotel, San Francisco, CA< / span >
< / a >
< / span >
< / div >
< p class = "vevent" id = "06-component-vevent-uri-relative" >
< a class = "url summary" href = "/squidlist/calendar/12279/2006/1/15" > Bad Movie Night - Gigli (blame mike spiegelman)< / a >
< br / >
< abbr class = "dtstart" title = "20060115T000000" > Sun, Jan 15 : 8pm< / abbr >
< br / >
< / p >
< div class = "vevent" id = "07-component-vevent-description-simple" >
< div class = "description" > Project xyz Review Meeting Minutes< / div >
< / div >
< div class = "aaa vevent" id = "08-component-vevent-multiple-classes" >
< a class = "bbb url" href = "http://www.web2con.com/" >
< span class = "ccc summary" > Web 2.0 Conference< / span > :
< abbr class = "ddd dtstart" title = "2005-10-05" > October 5< / abbr > -
< abbr class = "eee dtend" title = "2005-10-08" > 7< / abbr > ,
at the < span class = "fff location" > Argent Hotel, San Francisco, CA< / span >
< / a >
< / div >
< ul >
< li class = "vevent" id = "09-component-vevent-summary-in-img-alt" >
< a class = "url" href = "http://conferences.oreillynet.com/et2006/" >
< img style = "display:block" class = "summary"
src="http://conferences.oreillynet.com/images/et2005/logo_sm.gif"
alt="O'Reilly Emerging Technology Conference" />
< abbr class = "dtstart" title = "20060306" >
3/6< / abbr > -< abbr class = "dtend" title = "20060310" > 9< / abbr >
@
< span class = "location" >
Manchester Grand Hyatt in San Diego, CA
< / span >
< / a >
< / li >
< / ul >
< div class = "vcalendar" >
< div class = "vevent" id = "10-component-vevent-entity" >
< div class = "summary" > Cricket & Tennis Centre< / div >
< div class = "description" > Melbourne' s Cricket & Tennis Centres are in the heart of the city< / div >
< / div >
< / div >
< p class = "schedule vevent" id = "11-component-vevent-summary-in-subelements" >
< span class = "summary" >
< span style = "font-weight:bold; color: #3E4876;" > Welcome!< / span >
< a href = "/cs/web2005/view/e_spkr/1852" > John Battelle< / a > ,
< a href = "/cs/web2005/view/e_spkr/416" > Tim O'Reilly< / a >
< / span >
< br / >
< b > Time:< / b >
< abbr class = "dtstart" title = "20051005T1630-0700" > 4:30pm< / abbr > -
< abbr class = "dtend" title = "20051005T1645-0700" > 4:45pm
< / abbr >
< / p >
< p class = "vevent" id = "12-component-vevent-summary-url-in-same-class" >
< a class = "url summary" href = "http://www.laughingsquid.com/squidlist/calendar/12377/2006/1/25" > Art Reception for Tom Schultz and Felix Macnee< / a >
< br / >
< abbr class = "dtstart" title = "20060125T000000" > Wed, Jan 25 : 6:00 pm - 9:00 pm< / abbr >
< br / >
< / p >
< div class = "vcalendar" >
< div class = "vevent" id = "13-component-vevent-summary-url-property" >
< span class = "summary" >
< a class = "url" href = "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" > ORD-SFO/AA 1655< / a >
< / span >
< / div >
< / div >
< div class = "vcalendar" >
< span class = "vevent" id = "15-calendar-xml-lang" >
< a class = "url" href = "http://www.web2con.com/" >
< span class = "summary" > Web 2.0 Conference< / span > :
< abbr class = "dtstart" title = "2005-10-05" > October 5< / abbr > -
< abbr class = "dtend" title = "2005-10-08" > 7< / abbr > ,
at the < span class = "location" > Argent Hotel, San Francisco, CA< / span >
< / a >
< / span >
< / div >
< div class = "vcalendar" >
< span class = "vevent" id = "16-calendar-force-outlook" >
< a class = "url" href = "http://www.web2con.com/" >
< abbr class = "dtstart" title = "2005-10-05" > October 5< / abbr > -
< abbr class = "dtend" title = "2005-10-08" > 7< / abbr > ,
at the < span class = "location" > Argent Hotel, San Francisco, CA< / span >
< / a >
< / span >
< / div >
< p class = "vevent" id = "17-component-vevent-description-value-in-subelements" >
< span class = "description" >
RESOLUTION: to have a
< b class = "summary" > 3rd PAW ftf meeting< / b >
< abbr class = "dtstart" title = "2006-01-18" > 18< / abbr > -< abbr class = "dtend" title = "2006-01-20" > 19 Jan< / abbr > in
< em class = "location" > Maryland< / em > ; location contingent on confirmation from timbl< / span >
< / p >
< div class = "vevent" id = "18-component-vevent-uid.1" >
< div > UID: < span class = "uid" > http://example.com/foo.html< / span > < / div >
< / div >
< div class = "vevent" id = "18-component-vevent-uid.2" >
UID: < a class = "uid" href = "http://example.com/foo.html" > another hcal event< / a >
< / div >
< div class = "vevent" id = "18-component-vevent-uid.3" >
UID: < object class = "uid" data = "http://example.com/foo.html" > another hcal event< / object >
< / div >
< div class = "vevent" id = "18-component-vevent-uid.4" >
UID: < map id = "foo" > < area alt = "uid" class = "uid" href = "http://example.com/foo.html" / > < / map >
< / div >
< div class = "vevent" id = "18-component-vevent-uid.5" >
UID: < img class = "uid" alt = "uid" src = "http://example.com/foo.html" / >
< / div >
< div class = "vcalendar" >
< div class = "vevent" id = "19-calendar-attachments" >
< div > Start Time: < abbr class = "dtstart" title = "19970324T123000Z" > March 24, 1997 12:30 UTC< / abbr > < / div >
< div class = "summary" > Calendaring Interoperability Planning Meeting< / div >
< div > Attachments:
< ul >
< li > < a class = "attach" href = "http://microformats.org/img/logo.gif" > microformats logo< / a > < / li >
< li > < a class = "attach" type = "application/postscript" href = "ftp://xyzCorp.com/pub/conf/bkgrnd.ps" > ftp://xyzCorp.com/pub/conf/bkgrnd.ps< / a > < / li >
< / ul >
< / div >
< / div >
< / div >
2008-09-14 16:58:05 -07:00
< div class = "vevent" id = "empty-description" >
< span class = "description" > < / span >
< / div >
2007-09-20 11:07:13 -07:00
< / div >
< pre id = "test" >
< script class = "testbody" type = "text/javascript" >
test_Microformats();
test_hCard();
function test_Microformats() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Components.utils.import("resource://gre/modules/Microformats.js");
ok(Microformats, "Check global access to Microformats");
};
function test_hCard() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Components.utils.import("resource://gre/modules/Microformats.js");
var hcalendar;
hcalendar = new hCalendar(document.getElementById("01-component-vevent-dtstart-date"));
is(hcalendar.dtstart, "1997-09-03", "01-component-vevent-dtstart-date - dtstart");
hcalendar = new hCalendar(document.getElementById("02-component-vevent-dtstart-datetime"));
is(hcalendar.dtstart, "1997-09-03T16:30:00Z", "02-component-vevent-dtstart-datetime - dtstart");
hcalendar = new hCalendar(document.getElementById("03-component-vevent-dtend-date"));
is(hcalendar.dtstart, "1997-09-03", "03-component-vevent-dtend-date - dtstart");
is(hcalendar.dtend, "1997-09-04", "03-component-vevent-dtend-date - dtend");
hcalendar = new hCalendar(document.getElementById("04-component-vevent-dtend-datetime"));
is(hcalendar.dtstart, "1997-09-03T16:00:00Z", "04-component-vevent-dtend-datetime - dtstart");
is(hcalendar.dtend, "1997-09-03T18:00:00Z", "04-component-vevent-dtend-datetime - dtend");
hcalendar = new hCalendar(document.getElementById("05-calendar-simple"));
is(hcalendar.dtstart, "2005-10-05", "05-calendar-simple - dtstart");
is(hcalendar.dtend, "2005-10-08", "05-calendar-simple - dtend");
is(hcalendar.url, "http://www.web2con.com/", "05-calendar-simple - url");
is(hcalendar.summary, "Web 2.0 Conference", "05-calendar-simple - summary");
is(hcalendar.location, "Argent Hotel, San Francisco, CA", "05-calendar-simple - location");
hcalendar = new hCalendar(document.getElementById("06-component-vevent-uri-relative"));
is(hcalendar.url, "http://localhost:8888/squidlist/calendar/12279/2006/1/15", "06-component-vevent-uri-relative - url");
is(hcalendar.summary, "Bad Movie Night - Gigli (blame mike spiegelman)", "06-component-vevent-uri-relative - summary");
is(hcalendar.dtstart, "2006-01-15T00:00:00", "06-component-vevent-uri-relative - dtstart");
hcalendar = new hCalendar(document.getElementById("07-component-vevent-description-simple"));
is(hcalendar.description, "Project xyz Review Meeting Minutes", "07-component-vevent-description-simple - description");
hcalendar = new hCalendar(document.getElementById("08-component-vevent-multiple-classes"));
is(hcalendar.dtstart, "2005-10-05", "08-component-vevent-multiple-classes - dtstart");
is(hcalendar.dtend, "2005-10-08", "08-component-vevent-multiple-classes - dtend");
is(hcalendar.url, "http://www.web2con.com/", "08-component-vevent-multiple-classes - url");
is(hcalendar.summary, "Web 2.0 Conference", "08-component-vevent-multiple-classes - summary");
is(hcalendar.location, "Argent Hotel, San Francisco, CA", "08-component-vevent-multiple-classes - location");
hcalendar = new hCalendar(document.getElementById("09-component-vevent-summary-in-img-alt"));
is(hcalendar.dtstart, "2006-03-06", "09-component-vevent-summary-in-img-alt - dtstart");
is(hcalendar.dtend, "2006-03-10", "09-component-vevent-summary-in-img-alt - dtend");
is(hcalendar.url, "http://conferences.oreillynet.com/et2006/", "09-component-vevent-summary-in-img-alt - url");
is(hcalendar.summary, "O'Reilly Emerging Technology Conference", "09-component-vevent-summary-in-img-alt - summary");
is(hcalendar.location, "Manchester Grand Hyatt in San Diego, CA", "09-component-vevent-summary-in-img-alt - location");
hcalendar = new hCalendar(document.getElementById("10-component-vevent-entity"));
is(hcalendar.summary, "Cricket & Tennis Centre", "10-component-vevent-entity - summary");
is(hcalendar.description, "Melbourne's Cricket & Tennis Centres are in the heart of the city", "10-component-vevent-entity - description");
hcalendar = new hCalendar(document.getElementById("11-component-vevent-summary-in-subelements"));
is(hcalendar.dtstart, "2005-10-05T16:30:00-0700", "11-component-vevent-summary-in-subelements - dtstart");
is(hcalendar.dtend, "2005-10-05T16:45:00-0700", "11-component-vevent-summary-in-subelements - dtend");
is(hcalendar.summary, "Welcome! John Battelle, Tim O'Reilly", "11-component-vevent-summary-in-subelements - summary");
hcalendar = new hCalendar(document.getElementById("12-component-vevent-summary-url-in-same-class"));
is(hcalendar.dtstart, "2006-01-25T00:00:00", "12-component-vevent-summary-url-in-same-class - dtstart");
is(hcalendar.summary, "Art Reception for Tom Schultz and Felix Macnee", "12-component-vevent-summary-url-in-same-class - summary");
is(hcalendar.url, "http://www.laughingsquid.com/squidlist/calendar/12377/2006/1/25", "12-component-vevent-summary-url-in-same-class - url");
hcalendar = new hCalendar(document.getElementById("13-component-vevent-summary-url-property"));
is(hcalendar.summary, "ORD-SFO/AA 1655", "13-component-vevent-summary-url-property - summary");
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");
hcalendar = new hCalendar(document.getElementById("15-calendar-xml-lang"));
is(hcalendar.dtend, "2005-10-08", "15-calendar-xml-lang - dtend");
is(hcalendar.dtstart, "2005-10-05", "15-calendar-xml-lang - dtstart");
is(hcalendar.location, "Argent Hotel, San Francisco, CA", "15-calendar-xml-lang - location");
is(hcalendar.summary, "Web 2.0 Conference", "15-calendar-xml-lang - summary");
is(hcalendar.url, "http://www.web2con.com/", "15-calendar-xml-lang - url");
hcalendar = new hCalendar(document.getElementById("16-calendar-force-outlook"));
is(hcalendar.dtend, "2005-10-08", "16-calendar-force-outlook - dtend");
is(hcalendar.dtstart, "2005-10-05", "16-calendar-force-outlook - dtstart");
is(hcalendar.location, "Argent Hotel, San Francisco, CA", "16-calendar-force-outlook - location");
is(hcalendar.url, "http://www.web2con.com/", "16-calendar-force-outlook - url");
hcalendar = new hCalendar(document.getElementById("17-component-vevent-description-value-in-subelements"));
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");
is(hcalendar.dtstart, "2006-01-18", "17-component-vevent-description-value-in-subelements - dtstart");
is(hcalendar.dtend, "2006-01-20", "17-component-vevent-description-value-in-subelements - dtend");
is(hcalendar.location, "Maryland", "17-component-vevent-description-value-in-subelements - location");
is(hcalendar.summary, "3rd PAW ftf meeting", "17-component-vevent-description-value-in-subelements - summary");
hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.1"));
hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.2"));
hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.3"));
hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.4"));
hcalendar = new hCalendar(document.getElementById("18-component-vevent-uid.5"));
hcalendar = new hCalendar(document.getElementById("19-calendar-attachments"));
2008-09-14 16:58:05 -07:00
hcalendar = new hCalendar(document.getElementById("empty-description"));
is (hcalendar.description, "", "Empty description");
2007-09-20 11:07:13 -07:00
}
< / script >
< / pre >
< / body >
< / html >