blob: 7b37d0189864d957a213efe5ec6d0e8e3633e46d [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.value is "x"
PASS String(element.htmlFor) is "x"
PASS element.htmlFor.value is "y"
PASS String(element.htmlFor) is "y"
PASS element.htmlFor.length is 0
PASS element.htmlFor.length is 1
PASS element.htmlFor.length is 2
PASS element.htmlFor.length is 2
PASS element.htmlFor.toString() is "x"
PASS element.htmlFor.toString() is "x"
PASS element.htmlFor.toString() is "x x"
PASS element.htmlFor.toString() is "y x"
PASS element.htmlFor.toString() is ""
PASS element.htmlFor.toString() is ""
PASS element.htmlFor.toString() is "y 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("") did not throw exception.
PASS element.htmlFor.contains("x y") did not throw exception.
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 "x"
PASS element.htmlFor.item(1) is "x"
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