Mozilla/mozilla/toolkit/components/microformats/tests/test_framerecursion.html
ctalbert%mozilla.com b192f054b6 Bug 427457 More tests for microformats API r=mkaply
git-svn-id: svn://10.0.0.236/trunk@252610 18797224-902f-48f8-a5cc-f745e15eee43
2008-06-26 19:09:10 +00:00

67 lines
2.2 KiB
HTML

<!-- Demonstrates that we are always counting MF's in a <frame> tag, and NEVER
counting MF's in an <iframe> regardless of what the "frame recursion" bit
is set to. -->
<html>
<head>
<title>Testing Mixed Up Microformat APIs</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 id="contentbody">
<frameset>
<frame id="frame1">
<div>
<span class="notAMicroformat" id="notme">
<abbr class="foo">I am not a microformat</abbr>
<abbr class="title">Foolish title, not a format</abbr>
</span>
</div>
</frame>
<frame id="frame3">
<span class="geo" id="02-geo-abbr-latlong" >
<abbr class="latitude" title="75.77">Far Northern</abbr>
<abbr class="longitude" title="-122.41">Canada</abbr>
</span>
</frame>
<frame id="frame2">
<div class="stuff">
<span>Testing is Fun!</span>
</div>
</frame>
</frameset>
<!-- Geo -->
<iframe id="iframe" src="geo.html" onload="onLoad();">
</iframe>
<!-- Ok, the test, here we go -->
<pre id="test">
<script class="testbody" type="text/javascript">
// Start the test once the iFrame loads
function onLoad() {
test_MicroformatsAPI();
}
function test_MicroformatsAPI() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Components.utils.import("resource://gre/modules/Microformats.js");
count = Microformats.count("geo",
document.getElementById("contentbody"),
{recurseExternalFrames: false},
0);
is(count, 1, "Only one geo - we don't count external frames");
count = Microformats.count("geo",
document.getElementById("contentbody"),
{recurseExternalFrames: true});
is(count, 2, "Two Geo's - one in frame and one in iframe");
}
</script>
</body>
</html>