Test JS objects as NodeFilters.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Testing with raw function filter
filtering node A1 [this=[object Window]]
PASS walker.firstChild(); walker.currentNode.id is 'A1'
filtering node B1 [this=[object Window]]
filtering node B2 [this=[object Window]]
PASS walker.nextNode(); walker.currentNode.id is 'B2'
Testing with strict raw function filter
filtering node A1 [this=undefined]
PASS walker.firstChild(); walker.currentNode.id is 'A1'
filtering node B1 [this=undefined]
filtering node B2 [this=undefined]
PASS walker.nextNode(); walker.currentNode.id is 'B2'
Testing with object filter
filtering node A1 [this=custom node filter]
PASS walker.firstChild(); walker.currentNode.id is 'A1'
filtering node B1 [this=custom node filter]
filtering node B2 [this=custom node filter]
PASS walker.nextNode(); walker.currentNode.id is 'B2'
Testing with null filter
PASS walker.firstChild(); walker.currentNode.id is 'A1'
PASS walker.nextNode(); walker.currentNode.id is 'B1'
Testing with undefined filter
PASS walker.firstChild(); walker.currentNode.id is 'A1'
PASS walker.nextNode(); walker.currentNode.id is 'B1'
Testing with object lacking acceptNode property
PASS walker.firstChild(); threw exception TypeError: Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is not callable..
PASS walker.currentNode.id; is 'root'
PASS walker.nextNode(); threw exception TypeError: Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is not callable..
PASS walker.currentNode.id; is 'root'
Testing with object with non-function acceptNode property
PASS walker.firstChild(); threw exception TypeError: Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is not callable..
PASS walker.currentNode.id; is 'root'
PASS walker.nextNode(); threw exception TypeError: Failed to execute 'acceptNode' on 'NodeFilter': The provided callback is not callable..
PASS walker.currentNode.id; is 'root'
Testing with function having acceptNode function
PASS walker.firstChild(); walker.currentNode.id is 'A1'
PASS walker.nextNode(); walker.currentNode.id is 'B1'
Testing acceptNode callee
Callee: function(node) {
debug('Callee: ' + arguments.callee);
return NodeFilter.FILTER_ACCEPT;
}
PASS walker.firstChild(); walker.currentNode.id is 'A1'
PASS successfullyParsed is true
TEST COMPLETE