blob: 3478016ab41be62b8b953ef465fa7ade87b57312 [file] [log] [blame]
Tests the htmlFor attribute and its properties.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
- Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/
PASS element.htmlFor.__proto__ is DOMTokenList.prototype
PASS String(element.htmlFor) is "y z"
PASS element.htmlFor.value is "y z"
PASS element.getAttribute("for") is "y z"
PASS String(element.htmlFor) is "r s t"
PASS element.htmlFor.length is 0
PASS element.htmlFor.length is 1
PASS element.htmlFor.length is 1
PASS element.htmlFor.length is 2
PASS element.htmlFor.toString() is "x"
PASS element.htmlFor.toString() is "x"
PASS element.htmlFor.toString() is "x"
PASS element.htmlFor.toString() is "y x"
PASS element.htmlFor.toString() is ""
PASS element.htmlFor.toString() is ""
PASS element.htmlFor.toString() is "y"
PASS element.htmlFor.toString() is "y"
- Ensure that we can handle empty form attribute correctly
PASS list.value is "x"
PASS list.value is ""
PASS element.htmlFor.contains('x') is false
PASS element.htmlFor[1] is undefined.
PASS element.htmlFor.contains('x') is true
PASS element.htmlFor[1] is undefined.
- Testing add in presence of trailing white spaces.
PASS element.htmlFor.toString() is "x y"
PASS element.htmlFor.toString() is "x y"
PASS element.htmlFor.toString() is "y"
- Test invalid tokens
PASS element.htmlFor.contains('') is false
PASS element.htmlFor.contains('x y') is false
PASS element.htmlFor.add('') threw expected DOMException with code 12
PASS element.htmlFor.add('x y') threw expected DOMException with code 5
PASS element.htmlFor.remove('') threw expected DOMException with code 12
PASS element.htmlFor.remove('x y') threw expected DOMException with code 5
PASS element.htmlFor.toggle('') threw expected DOMException with code 12
PASS element.htmlFor.toggle('x y') threw expected DOMException with code 5
- Indexing
PASS element.htmlFor[0] is "x"
PASS element.htmlFor.item(0) is "x"
PASS element.htmlFor[1] is undefined.
PASS element.htmlFor.item(1) is null
PASS element.htmlFor[1] is "y"
PASS element.htmlFor.item(1) is "y"
PASS element.htmlFor[0] is undefined.
PASS element.htmlFor.item(0) is null
PASS element.htmlFor[4] is undefined.
PASS element.htmlFor.item(4) is null
PASS element.htmlFor[-1] is undefined.
PASS element.htmlFor.item(-1) is null
- Test case since DOMTokenList is case sensitive
PASS element.htmlFor.contains('x') is true
PASS element.htmlFor.contains('X') is false
PASS element.htmlFor[0] is "x"
PASS element.htmlFor.contains('X') is true
PASS element.htmlFor.contains('x') is false
PASS element.htmlFor[0] is "X"
- Testing whitespace
PASS element.htmlFor.length is 2
PASS element.htmlFor.length is 2
PASS element.htmlFor.length is 2
PASS element.htmlFor.length is 2
PASS element.htmlFor.length is 2
- DOMTokenList presence and type
PASS 'undefined' != typeof DOMTokenList is true
PASS typeof DOMTokenList.prototype is "object"
PASS typeof element.htmlFor is "object"
PASS element.htmlFor.constructor is DOMTokenList
PASS element.htmlFor === element.htmlFor is true
PASS successfullyParsed is true
TEST COMPLETE