OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 // This test mostly comes from fast/dom/HTMLElement/script-tests/class-list.js | 8 // This test mostly comes from fast/dom/HTMLElement/script-tests/class-list.js |
9 description('Tests the htmlFor attribute and its properties.'); | 9 description('Tests the htmlFor attribute and its properties.'); |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 shouldBeEqualToString('element.htmlFor.toString()', 'x'); | 51 shouldBeEqualToString('element.htmlFor.toString()', 'x'); |
52 | 52 |
53 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/006.htm | 53 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/006.htm |
54 createElement('x'); | 54 createElement('x'); |
55 element.htmlFor.add('x'); | 55 element.htmlFor.add('x'); |
56 shouldBeEqualToString('element.htmlFor.toString()', 'x'); | 56 shouldBeEqualToString('element.htmlFor.toString()', 'x'); |
57 | 57 |
58 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/007.htm | 58 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/007.htm |
59 createElement('x x'); | 59 createElement('x x'); |
60 element.htmlFor.add('x'); | 60 element.htmlFor.add('x'); |
61 shouldBeEqualToString('element.htmlFor.toString()', 'x x'); | 61 shouldBeEqualToString('element.htmlFor.toString()', 'x x'); |
62 | 62 |
63 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/008.htm | 63 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/008.htm |
64 createElement('y'); | 64 createElement('y'); |
65 element.htmlFor.add('x'); | 65 element.htmlFor.add('x'); |
66 shouldBeEqualToString('element.htmlFor.toString()', 'y x'); | 66 shouldBeEqualToString('element.htmlFor.toString()', 'y x'); |
67 | 67 |
68 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/009.htm | 68 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/009.htm |
69 createElement(''); | 69 createElement(''); |
70 element.htmlFor.remove('x'); | 70 element.htmlFor.remove('x'); |
71 shouldBeEqualToString('element.htmlFor.toString()', ''); | 71 shouldBeEqualToString('element.htmlFor.toString()', ''); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 shouldBeUndefined('element.htmlFor[1]'); | 104 shouldBeUndefined('element.htmlFor[1]'); |
105 | 105 |
106 debug('- Testing add in presence of trailing white spaces.'); | 106 debug('- Testing add in presence of trailing white spaces.'); |
107 | 107 |
108 createElement('x '); | 108 createElement('x '); |
109 element.htmlFor.add('y'); | 109 element.htmlFor.add('y'); |
110 shouldBeEqualToString('element.htmlFor.toString()', 'x y'); | 110 shouldBeEqualToString('element.htmlFor.toString()', 'x y'); |
111 | 111 |
112 createElement('x\t'); | 112 createElement('x\t'); |
113 element.htmlFor.add('y'); | 113 element.htmlFor.add('y'); |
114 shouldBeEqualToString('element.htmlFor.toString()', 'x\ty'); | 114 shouldBeEqualToString('element.htmlFor.toString()', 'x y'); |
115 | 115 |
116 createElement(' '); | 116 createElement(' '); |
117 element.htmlFor.add('y'); | 117 element.htmlFor.add('y'); |
118 shouldBeEqualToString('element.htmlFor.toString()', ' y'); | 118 shouldBeEqualToString('element.htmlFor.toString()', 'y'); |
119 | 119 |
120 | 120 |
121 debug('- Test invalid tokens'); | 121 debug('- Test invalid tokens'); |
122 | 122 |
123 // Testing exception due to invalid token | 123 // Testing exception due to invalid token |
124 | 124 |
125 // shouldThrow from js-test.js is not sufficient. | 125 // shouldThrow from js-test.js is not sufficient. |
126 function shouldThrowDOMException(f, ec) | 126 function shouldThrowDOMException(f, ec) |
127 { | 127 { |
128 try { | 128 try { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 createElement('x'); | 257 createElement('x'); |
258 shouldBeEqualToString('typeof element.htmlFor', 'object'); | 258 shouldBeEqualToString('typeof element.htmlFor', 'object'); |
259 | 259 |
260 shouldEvaluateTo('element.htmlFor.constructor', 'DOMTokenList'); | 260 shouldEvaluateTo('element.htmlFor.constructor', 'DOMTokenList'); |
261 | 261 |
262 shouldBeTrue('element.htmlFor === element.htmlFor'); | 262 shouldBeTrue('element.htmlFor === element.htmlFor'); |
263 </script> | 263 </script> |
264 </body> | 264 </body> |
265 </html> | 265 </html> |
OLD | NEW |