gecko/toolkit/components/microformats/tests/test_Microformats_geo.html

110 lines
3.5 KiB
HTML

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Testing Microformats.js (geo)</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<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">
<span class="geo" id="01-geo-basic">
<span class="latitude">37.77</span>
<span class="longitude">-122.411</span>
</span>
<span class="geo" id="01-geo-abbr-latlong" >
<abbr class="latitude" title="37.77">Northern</abbr>
<abbr class="longitude" title="-122.41">California</abbr>
</span>
<abbr class="geo" id="01-geo-abbr" title="30.267991;-97.739568">Paradise</abbr>
<span class="vcard">
<span class="fn org">John Doe</span>
<abbr class="geo" id="02-geo-vcard-01" title="37.77;-122.41"></abbr>
</span>
<span class="vcard">
<span class="fn org">John Doe</span>
<abbr class="geo" id="02-geo-vcard-02" title="37.77;-122.41">Northern California</abbr>
</span>
<span class="vevent">
<span class="summary">SXSW Interactive (South by Southwest)</span>
<ABBR title="20080307" class="dtstart">Friday, March 7, 2008</ABBR>
-
<ABBR title="20080311" class="dtend">Tuesday, March 11, 2008</ABBR>
<abbr class="geo" id="02-geo-vevent-01" title="30.2622;-97.7399"></abbr>
</span>
<span class="vevent">
<span class="summary">SXSW Interactive (South by Southwest)</span>
<ABBR title="20080307" class="dtstart">Friday, March 7, 2008</ABBR>
-
<ABBR title="20080311" class="dtend">Tuesday, March 11, 2008</ABBR>
<abbr class="geo" id="02-geo-vevent-02" title="30.2622;-97.7399">Convention Center</abbr>
</span>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
test_Microformats();
test_geo();
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_geo() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Components.utils.import("resource://gre/modules/Microformats.js");
var Geo;
Geo = new geo(document.getElementById("01-geo-basic"));
is(Geo.latitude, "37.77", "01-geo-basic - latitude");
is(Geo.longitude, "-122.411", "01-geo-basic - longitude");
Geo = new geo(document.getElementById("01-geo-abbr-latlong"));
is(Geo.latitude, "37.77", "02-geo-abbr-latlong - latitude");
is(Geo.longitude, "-122.41", "02-geo-abbr-latlong - longitude");
Geo = new geo(document.getElementById("01-geo-abbr"));
is(Geo.latitude, "30.267991", "01-geo-abbr - latitude");
is(Geo.longitude, "-97.739568", "01-geo-abbr - longitude");
Geo = new geo(document.getElementById("02-geo-vcard-01"));
is(Geo.toString(), "John Doe", "02-geo-vcard-01");
Geo = new geo(document.getElementById("02-geo-vcard-02"));
is(Geo.toString(), "Northern California", "02-geo-vcard-02");
Geo = new geo(document.getElementById("02-geo-vevent-01"));
is(Geo.toString(), "SXSW Interactive (South by Southwest)", "02-geo-vevent-01");
Geo = new geo(document.getElementById("02-geo-vevent-02"));
is(Geo.toString(), "Convention Center", "02-geo-vevent-02");
}
</script>
</pre>
</body>
</html>