1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug698384.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 + <!-- 1.7 + https://bugzilla.mozilla.org/show_bug.cgi?id=698384 1.8 + --> 1.9 + <head> 1.10 + <title>Test for Bug 698384</title> 1.11 + <script type="text/javascript" 1.12 + src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script src="/tests/SimpleTest/EventUtils.js" 1.14 + type="text/javascript"></script> 1.15 + <link rel="stylesheet" type="text/css" 1.16 + href="/tests/SimpleTest/test.css" /> 1.17 + </head> 1.18 + <body onload="runTests();"> 1.19 + <a target="_blank" 1.20 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=698384"> 1.21 + Mozilla Bug 698384</a> 1.22 + <p id="display"></p> 1.23 + <div id="content" style="display: none"></div> 1.24 + <pre id="test"> 1.25 + <script type="text/javascript"> 1.26 + /* 1.27 + Checks to see if default parameter handling is correct when 0, 1 1.28 + or 2 parameters are passed. 1.29 + 1.30 + If one is only passed, aFilter should default to null 1.31 + If none are passed, aFilter should be null and aWhatToShow should 1.32 + be NodeFilter.SHOW_ALL 1.33 + */ 1.34 + SimpleTest.waitForExplicitFinish(); 1.35 + 1.36 + var content = $('content'), 1.37 + ni; 1.38 + 1.39 + content.innerHTML = ('<span id="A"><\/span><span id="B"><\/span>' 1.40 + + '<span id="C"><\/span>'); 1.41 + 1.42 + function runTests() { 1.43 + 1.44 + // Test NodeIterator when no optional arguments are given 1.45 + ni = document.createNodeIterator(content); 1.46 + is(ni.whatToShow, NodeFilter.SHOW_ALL, "whatToShow should be " + 1.47 + "NodeFilter.SHOW_ALL when both " + 1.48 + " optionals are not given"); 1.49 + is(ni.filter, null, "filter should be defaulted to null when both " + 1.50 + " optionals are not given"); 1.51 + 1.52 + // Test NodeIterator when first optional is passed 1.53 + ni = document.createNodeIterator(content, NodeFilter.SHOW_ELEMENT); 1.54 + is(ni.filter, null, "filter should be defaulted to null when only " + 1.55 + " first argument is passed"); 1.56 + is(ni.whatToShow, NodeFilter.SHOW_ELEMENT, "whatToShow should " + 1.57 + "properly be set to NodeFilter.SHOW_ELEMENT when whatToShow is " + 1.58 + "provided and filter is not"); 1.59 + 1.60 + SimpleTest.finish(); 1.61 + } 1.62 + </script> 1.63 + </pre> 1.64 + </body> 1.65 +</html>