toolkit/components/microformats/tests/test_framerecursion.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!-- Demonstrates that we are always counting MF's in a <frame> tag, and NEVER
     2      counting MF's in an <iframe> regardless of what the "frame recursion" bit
     3      is set to. -->
     4 <html>
     5 <head>
     6   <title>Testing Mixed Up Microformat APIs</title>
     7   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     8   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
    10 </head>
    11 <body id="contentbody">
    12   <pre id="test">
    13   <script class="testbody" type="text/javascript">
    15   // Start the test once the iFrame loads
    16   function onLoad() {
    17     test_MicroformatsAPI();
    18   }
    20   function test_MicroformatsAPI() {
    21     var Microformats = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").Microformats;
    23     count = Microformats.count("geo",
    24                               document.getElementById("contentbody"),
    25                               {recurseExternalFrames: false},
    26                               0);
    27     is(count, 1, "Only one geo - we don't count external frames");
    29     count = Microformats.count("geo",
    30                               document.getElementById("contentbody"),
    31                               {recurseExternalFrames: true});
    32     is(count, 2, "Two Geo's - one in frame and one in iframe");
    33   }
    34   </script>
    35   </pre>
    37   <frameset>
    38     <frame id="frame1">
    39       <div>
    40         <span class="notAMicroformat" id="notme">
    41           <abbr class="foo">I am not a microformat</abbr>
    42           <abbr class="title">Foolish title, not a format</abbr>
    43         </span>
    44       </div>
    45     </frame>
    46     <frame id="frame3">
    47       <span class="geo" id="02-geo-abbr-latlong" >
    48         <abbr class="latitude" title="75.77">Far Northern</abbr>
    49         <abbr class="longitude" title="-122.41">Canada</abbr>
    50       </span>
    51     </frame>
    52     <frame id="frame2">
    53       <div class="stuff">
    54         <span>Testing is Fun!</span>
    55       </div>
    56     </frame>
    57   </frameset>
    59   <!-- Geo -->
    60   <iframe id="iframe" src="geo.html" onload="onLoad();">
    61   </iframe>
    62 </body>
    63 </html>

mercurial