content/base/test/test_bug698384.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:db2ac8d60298
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=698384
5 -->
6 <head>
7 <title>Test for Bug 698384</title>
8 <script type="text/javascript"
9 src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script src="/tests/SimpleTest/EventUtils.js"
11 type="text/javascript"></script>
12 <link rel="stylesheet" type="text/css"
13 href="/tests/SimpleTest/test.css" />
14 </head>
15 <body onload="runTests();">
16 <a target="_blank"
17 href="https://bugzilla.mozilla.org/show_bug.cgi?id=698384">
18 Mozilla Bug 698384</a>
19 <p id="display"></p>
20 <div id="content" style="display: none"></div>
21 <pre id="test">
22 <script type="text/javascript">
23 /*
24 Checks to see if default parameter handling is correct when 0, 1
25 or 2 parameters are passed.
26
27 If one is only passed, aFilter should default to null
28 If none are passed, aFilter should be null and aWhatToShow should
29 be NodeFilter.SHOW_ALL
30 */
31 SimpleTest.waitForExplicitFinish();
32
33 var content = $('content'),
34 ni;
35
36 content.innerHTML = ('<span id="A"><\/span><span id="B"><\/span>'
37 + '<span id="C"><\/span>');
38
39 function runTests() {
40
41 // Test NodeIterator when no optional arguments are given
42 ni = document.createNodeIterator(content);
43 is(ni.whatToShow, NodeFilter.SHOW_ALL, "whatToShow should be " +
44 "NodeFilter.SHOW_ALL when both " +
45 " optionals are not given");
46 is(ni.filter, null, "filter should be defaulted to null when both " +
47 " optionals are not given");
48
49 // Test NodeIterator when first optional is passed
50 ni = document.createNodeIterator(content, NodeFilter.SHOW_ELEMENT);
51 is(ni.filter, null, "filter should be defaulted to null when only " +
52 " first argument is passed");
53 is(ni.whatToShow, NodeFilter.SHOW_ELEMENT, "whatToShow should " +
54 "properly be set to NodeFilter.SHOW_ELEMENT when whatToShow is " +
55 "provided and filter is not");
56
57 SimpleTest.finish();
58 }
59 </script>
60 </pre>
61 </body>
62 </html>

mercurial