OLD | NEW |
1 // This test mostly comes from fast/dom/HTMLElement/script-tests/class-list.js | 1 // This test mostly comes from fast/dom/HTMLElement/script-tests/class-list.js |
2 description('Tests the htmlFor attribute and its properties.'); | 2 description('Tests the htmlFor attribute and its properties.'); |
3 | 3 |
4 var container = document.createElement('div'); | 4 var container = document.createElement('div'); |
5 document.body.appendChild(container); | 5 document.body.appendChild(container); |
6 | 6 |
7 var element; | 7 var element; |
8 | 8 |
9 function createElement(tokenList) | 9 function createElement(tokenList) |
10 { | 10 { |
11 container.innerHTML = '<output for="' + tokenList + '"></output>'; | 11 container.innerHTML = '<output for="' + tokenList + '"></output>'; |
12 element = container.lastChild; | 12 element = container.lastChild; |
13 } | 13 } |
14 | 14 |
15 debug('- Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList
/'); | 15 debug('- Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList
/'); |
16 | 16 |
17 // HTMLOutputElement::htmlFor is readonly attribute. | 17 // HTMLOutputElement::htmlFor setter is forwarding assignment to DOMSettableToke
nList.value attribute. |
18 createElement('x'); | 18 createElement('x'); |
| 19 shouldBeEqualToString('element.htmlFor.value', 'x'); |
| 20 shouldBeEqualToString('String(element.htmlFor)', 'x'); |
19 element.htmlFor = 'y'; | 21 element.htmlFor = 'y'; |
20 shouldBeEqualToString('String(element.htmlFor)', 'x'); | 22 shouldBeEqualToString('element.htmlFor.value', 'y'); |
| 23 shouldBeEqualToString('String(element.htmlFor)', 'y'); |
21 | 24 |
22 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/001.htm | 25 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/001.htm |
23 createElement(''); | 26 createElement(''); |
24 shouldEvaluateTo('element.htmlFor.length', 0); | 27 shouldEvaluateTo('element.htmlFor.length', 0); |
25 | 28 |
26 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/002.htm | 29 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/002.htm |
27 createElement('x'); | 30 createElement('x'); |
28 shouldEvaluateTo('element.htmlFor.length', 1); | 31 shouldEvaluateTo('element.htmlFor.length', 1); |
29 | 32 |
30 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/003.htm | 33 // http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/getting/003.htm |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 shouldBeTrue('\'undefined\' != typeof DOMSettableTokenList'); | 246 shouldBeTrue('\'undefined\' != typeof DOMSettableTokenList'); |
244 | 247 |
245 shouldBeEqualToString('typeof DOMSettableTokenList.prototype', 'object'); | 248 shouldBeEqualToString('typeof DOMSettableTokenList.prototype', 'object'); |
246 | 249 |
247 createElement('x'); | 250 createElement('x'); |
248 shouldBeEqualToString('typeof element.htmlFor', 'object'); | 251 shouldBeEqualToString('typeof element.htmlFor', 'object'); |
249 | 252 |
250 shouldEvaluateTo('element.htmlFor.constructor', 'DOMSettableTokenList'); | 253 shouldEvaluateTo('element.htmlFor.constructor', 'DOMSettableTokenList'); |
251 | 254 |
252 shouldBeTrue('element.htmlFor === element.htmlFor'); | 255 shouldBeTrue('element.htmlFor === element.htmlFor'); |
OLD | NEW |