1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/microformats/tests/test_framerecursion.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +<!-- Demonstrates that we are always counting MF's in a <frame> tag, and NEVER 1.5 + counting MF's in an <iframe> regardless of what the "frame recursion" bit 1.6 + is set to. --> 1.7 +<html> 1.8 +<head> 1.9 + <title>Testing Mixed Up Microformat APIs</title> 1.10 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link> 1.13 +</head> 1.14 +<body id="contentbody"> 1.15 + <pre id="test"> 1.16 + <script class="testbody" type="text/javascript"> 1.17 + 1.18 + // Start the test once the iFrame loads 1.19 + function onLoad() { 1.20 + test_MicroformatsAPI(); 1.21 + } 1.22 + 1.23 + function test_MicroformatsAPI() { 1.24 + var Microformats = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").Microformats; 1.25 + 1.26 + count = Microformats.count("geo", 1.27 + document.getElementById("contentbody"), 1.28 + {recurseExternalFrames: false}, 1.29 + 0); 1.30 + is(count, 1, "Only one geo - we don't count external frames"); 1.31 + 1.32 + count = Microformats.count("geo", 1.33 + document.getElementById("contentbody"), 1.34 + {recurseExternalFrames: true}); 1.35 + is(count, 2, "Two Geo's - one in frame and one in iframe"); 1.36 + } 1.37 + </script> 1.38 + </pre> 1.39 + 1.40 + <frameset> 1.41 + <frame id="frame1"> 1.42 + <div> 1.43 + <span class="notAMicroformat" id="notme"> 1.44 + <abbr class="foo">I am not a microformat</abbr> 1.45 + <abbr class="title">Foolish title, not a format</abbr> 1.46 + </span> 1.47 + </div> 1.48 + </frame> 1.49 + <frame id="frame3"> 1.50 + <span class="geo" id="02-geo-abbr-latlong" > 1.51 + <abbr class="latitude" title="75.77">Far Northern</abbr> 1.52 + <abbr class="longitude" title="-122.41">Canada</abbr> 1.53 + </span> 1.54 + </frame> 1.55 + <frame id="frame2"> 1.56 + <div class="stuff"> 1.57 + <span>Testing is Fun!</span> 1.58 + </div> 1.59 + </frame> 1.60 + </frameset> 1.61 + 1.62 + <!-- Geo --> 1.63 + <iframe id="iframe" src="geo.html" onload="onLoad();"> 1.64 + </iframe> 1.65 +</body> 1.66 +</html>