blob: ca5da841b782b33ffe93bf0a49ccf87e245fdd3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
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: NodeFilter object does not have an acceptNode function.
PASS walker.currentNode.id; is 'root'
PASS walker.nextNode(); threw exception TypeError: NodeFilter object does not have an acceptNode function.
PASS walker.currentNode.id; is 'root'
Testing with object with non-function acceptNode property
PASS walker.firstChild(); threw exception TypeError: NodeFilter object does not have an acceptNode function.
PASS walker.currentNode.id; is 'root'
PASS walker.nextNode(); threw exception TypeError: NodeFilter object does not have an acceptNode function.
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
|