OLD | NEW |
1 Tests the classList attribute and its properties. | 1 Tests the classList attribute and its properties. |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/ | 6 Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/ |
7 PASS String(element.classList) is "y" | 7 PASS String(element.classList) is "y" |
8 PASS String(element.className) is "y" | 8 PASS String(element.className) is "y" |
9 PASS element.classList.length is 0 | 9 PASS element.classList.length is 0 |
10 PASS element.classList.length is 1 | 10 PASS element.classList.length is 1 |
11 PASS element.classList.length is 2 | 11 PASS element.classList.length is 2 |
12 PASS element.classList.length is 2 | 12 PASS element.classList.length is 2 |
13 PASS element.className is "x" | 13 PASS element.className is "x" |
14 PASS element.className is "x" | 14 PASS element.className is "x" |
15 PASS element.className is "x x" | 15 PASS element.className is "x x" |
16 PASS element.className is "y x" | 16 PASS element.className is "y x" |
17 PASS element.className is "" | 17 PASS element.className is "" |
18 PASS element.className is "" | 18 PASS element.className is "" |
19 PASS element.className is "y y" | 19 PASS element.className is "y y" |
20 PASS element.className is "y" | 20 PASS element.className is "y" |
21 Ensure that we can handle empty class name correctly | 21 Ensure that we can handle empty class name correctly |
22 PASS element.classList.toggle('x') is true | 22 PASS element.classList.toggle('x') is true |
23 PASS element.className is "x" | 23 PASS element.className is "x" |
24 PASS element.classList.toggle('x') is false | 24 PASS element.classList.toggle('x') is false |
25 PASS element.className is "" | 25 PASS element.className is "" |
26 PASS element.classList.contains('x') is false | 26 PASS element.classList.contains('x') is false |
27 PASS element.classList[1] is undefined. | 27 PASS element.classList[1] is undefined. |
28 Test toggle with force argument | 28 Test toggle with force argument |
29 PASS element.classList.toggle('x', true) is true | 29 PASS element.classList.toggle('x', true) is true |
30 PASS element.className is "x" | 30 PASS element.className is "x" |
31 PASS element.classList.toggle('x', true) is true | 31 PASS element.classList.toggle('x', true) is true |
32 PASS element.className is "x" | 32 PASS element.className is "x" |
33 PASS element.classList.toggle('x', false) is false | 33 PASS element.classList.toggle('x', false) is false |
34 PASS element.className is "" | 34 PASS element.className is "" |
35 PASS element.classList.toggle('x', false) is false | 35 PASS element.classList.toggle('x', false) is false |
36 PASS element.className is "" | 36 PASS element.className is "" |
37 PASS element.classList.toggle('', true) threw expected DOMException with code 12 | 37 PASS element.classList.toggle('', true) threw expected DOMException with code 12 |
38 PASS element.classList.toggle('x y', false) threw expected DOMException with cod
e 5 | 38 PASS element.classList.toggle('x y', false) threw expected DOMException with cod
e 5 |
39 Testing add in presence of trailing white spaces. | 39 Testing add in presence of trailing white spaces. |
40 PASS element.className is "x y" | 40 PASS element.className is "x y" |
41 PASS element.className is "x\ty" | 41 PASS element.className is "x y" |
42 PASS element.className is " y" | 42 PASS element.className is "y" |
43 Test invalid tokens | 43 Test invalid tokens |
44 PASS element.classList.contains('') threw expected DOMException with code 12 | 44 PASS element.classList.contains('') threw expected DOMException with code 12 |
45 PASS element.classList.contains('x y') threw expected DOMException with code 5 | 45 PASS element.classList.contains('x y') threw expected DOMException with code 5 |
46 PASS element.classList.add('') threw expected DOMException with code 12 | 46 PASS element.classList.add('') threw expected DOMException with code 12 |
47 PASS element.classList.add('x y') threw expected DOMException with code 5 | 47 PASS element.classList.add('x y') threw expected DOMException with code 5 |
48 PASS element.classList.remove('') threw expected DOMException with code 12 | 48 PASS element.classList.remove('') threw expected DOMException with code 12 |
49 PASS element.classList.remove('x y') threw expected DOMException with code 5 | 49 PASS element.classList.remove('x y') threw expected DOMException with code 5 |
50 PASS element.classList.toggle('') threw expected DOMException with code 12 | 50 PASS element.classList.toggle('') threw expected DOMException with code 12 |
51 PASS element.classList.toggle('x y') threw expected DOMException with code 5 | 51 PASS element.classList.toggle('x y') threw expected DOMException with code 5 |
52 PASS element.classList.toggle() threw exception TypeError: Failed to execute 'to
ggle' on 'DOMTokenList': 1 argument required, but only 0 present.. | 52 PASS element.classList.toggle() threw exception TypeError: Failed to execute 'to
ggle' on 'DOMTokenList': 1 argument required, but only 0 present.. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 PASS element.className is "a b" | 111 PASS element.className is "a b" |
112 PASS element.classList.remove("a", {toString: function() { throw new Error("user
error"); }}, "b") threw exception Error: user error. | 112 PASS element.classList.remove("a", {toString: function() { throw new Error("user
error"); }}, "b") threw exception Error: user error. |
113 PASS element.className is "a b" | 113 PASS element.className is "a b" |
114 PASS element.classList.remove() did not throw exception. | 114 PASS element.classList.remove() did not throw exception. |
115 PASS observer.takeRecords().length is 1 | 115 PASS observer.takeRecords().length is 1 |
116 PASS areArraysEqual(seen, ['a', 'b', 'c']) is true | 116 PASS areArraysEqual(seen, ['a', 'b', 'c']) is true |
117 PASS successfullyParsed is true | 117 PASS successfullyParsed is true |
118 | 118 |
119 TEST COMPLETE | 119 TEST COMPLETE |
120 | 120 |
OLD | NEW |