| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>TreeWalker: Basic test</title> | 4 <title>TreeWalker: Basic test</title> |
| 5 <script src="../../../resources/testharness.js"></script> | 5 <script src="../../../resources/testharness.js"></script> |
| 6 <script src="../../../resources/testharnessreport.js"></script> | 6 <script src="../../../resources/testharnessreport.js"></script> |
| 7 <link rel="stylesheet" href="../../../resources/testharness.css"> | 7 <link rel="stylesheet" href="../../../resources/testharness.css"> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <p>This test checks the basic functionality of TreeWalker.</p> | 10 <p>This test checks the basic functionality of TreeWalker.</p> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 assert_node(walker.previousNode(), { type: Element, id: 'c' }); | 113 assert_node(walker.previousNode(), { type: Element, id: 'c' }); |
| 114 assert_node(walker.currentNode, { type: Element, id: 'c' }); | 114 assert_node(walker.currentNode, { type: Element, id: 'c' }); |
| 115 assert_equals(walker.nextSibling(), null); | 115 assert_equals(walker.nextSibling(), null); |
| 116 assert_node(walker.currentNode, { type: Element, id: 'c' }); | 116 assert_node(walker.currentNode, { type: Element, id: 'c' }); |
| 117 walker.currentNode = f; | 117 walker.currentNode = f; |
| 118 assert_equals(walker.currentNode, f); | 118 assert_equals(walker.currentNode, f); |
| 119 }, 'Walk over nodes.'); | 119 }, 'Walk over nodes.'); |
| 120 | 120 |
| 121 // FIXME: Add tests that use |whatToShow| argument and/or |filter| argument. | 121 // FIXME: Add tests that use |whatToShow| argument and/or |filter| argument. |
| 122 | 122 |
| 123 test(function () | |
| 124 { | |
| 125 var filter = function () { | |
| 126 return NodeFilter.FILTER_ACCEPT; | |
| 127 }; | |
| 128 [true, false].forEach(function (expandEntityReferences) { | |
| 129 var walker = document.createTreeWalker(createSampleDOM(), NodeFilter.SHO
W_ALL, filter, expandEntityReferences); | |
| 130 assert_true(walker instanceof TreeWalker); | |
| 131 assert_false(walker.expandEntityReferences); | |
| 132 }); | |
| 133 }, 'Test that the fourth argument (expandEntityReferences) is ignored.'); | |
| 134 | |
| 135 test(function() { | 123 test(function() { |
| 136 var treeWalker = document.createTreeWalker(document.body, 42, null); | 124 var treeWalker = document.createTreeWalker(document.body, 42, null); |
| 137 assert_equals(treeWalker.root, document.body); | 125 assert_equals(treeWalker.root, document.body); |
| 138 assert_equals(treeWalker.currentNode, document.body); | 126 assert_equals(treeWalker.currentNode, document.body); |
| 139 assert_equals(treeWalker.whatToShow, 42); | 127 assert_equals(treeWalker.whatToShow, 42); |
| 140 assert_equals(treeWalker.filter, null); | 128 assert_equals(treeWalker.filter, null); |
| 141 }, "Optional arguments to createTreeWalker should be optional (3 passed, null)."
); | 129 }, "Optional arguments to createTreeWalker should be optional (3 passed, null)."
); |
| 142 </script> | 130 </script> |
| 143 </body> | 131 </body> |
| 144 </html> | 132 </html> |
| OLD | NEW |