| 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 |
| PASS walker.firstChild(); walker.currentNode.id is 'A1' |
| filtering node B1 |
| filtering node B2 |
| PASS walker.nextNode(); walker.currentNode.id is 'B2' |
| |
| Testing with object filter |
| filtering node A1 |
| PASS walker.firstChild(); walker.currentNode.id is 'A1' |
| filtering node B1 |
| filtering node B2 |
| 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: Type error. |
| PASS walker.currentNode.id; is 'root' |
| PASS walker.nextNode(); threw exception TypeError: Type error. |
| PASS walker.currentNode.id; is 'root' |
| |
| Testing with object with non-function acceptNode property |
| PASS walker.firstChild(); threw exception TypeError: Type error. |
| PASS walker.currentNode.id; is 'root' |
| PASS walker.nextNode(); threw exception TypeError: Type error. |
| 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 |
| |