229 lines
7.5 KiB
Plaintext
229 lines
7.5 KiB
Plaintext
This test checks the behavior of the add() method on the select.options object.
|
|
It covers both the the one-argument (1.x) and two-argument (2.x) signatures of the add() method.
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
1.1 Add Option to empty Options
|
|
PASS select1.options.length is 1
|
|
PASS select1.selectedIndex is 0
|
|
PASS select1.options[0].value is '1'
|
|
PASS select1.options[0].textContent is 'A'
|
|
|
|
1.2 Add Option to non-empty Options
|
|
PASS select1.options.length is 2
|
|
PASS select1.selectedIndex is 0
|
|
PASS select1.options[0].value is '1'
|
|
PASS select1.options[0].textContent is 'A'
|
|
PASS select1.options[1].value is '2'
|
|
PASS select1.options[1].textContent is 'B'
|
|
|
|
1.3 Add Option after setting parameters
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
PASS select1.options[0].value is '1'
|
|
PASS select1.options[0].textContent is 'A'
|
|
PASS select1.options[1].value is '2'
|
|
PASS select1.options[1].textContent is 'B'
|
|
PASS select1.options[2].value is '3'
|
|
PASS select1.options[2].textContent is 'C'
|
|
|
|
1.4 Add a non-Option element
|
|
PASS select1.options.add(div) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
1.5 Add a non-element (string)
|
|
PASS select1.options.add(option1) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
1.6 Add a non-element (number)
|
|
PASS select1.options.add(option1) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
1.7 Add a non-element (boolean)
|
|
PASS select1.options.add(option1) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
1.8 Add undefined
|
|
PASS select1.options.add(option1) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
1.9 Add null
|
|
PASS select1.options.add(option1) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
1.10 Add negative infinity
|
|
PASS select1.options.add(option1) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
1.11 Add NaN
|
|
PASS select1.options.add(option1) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
1.12 Add positive infinity
|
|
PASS select1.options.add(option1) threw exception TypeError: Type error.
|
|
PASS select1.options.length is 3
|
|
PASS select1.selectedIndex is 0
|
|
|
|
2.1 Add Option to empty Options
|
|
PASS select2.options.length is 1
|
|
PASS select2.selectedIndex is 0
|
|
PASS select2.options[0].value is '1'
|
|
PASS select2.options[0].textContent is 'A'
|
|
|
|
2.2 Add Option after setting parameters
|
|
PASS select2.options.length is 2
|
|
PASS select2.selectedIndex is 0
|
|
PASS select2.options[0].value is '1'
|
|
PASS select2.options[0].textContent is 'A'
|
|
PASS select2.options[1].value is '2'
|
|
PASS select2.options[1].textContent is 'B'
|
|
|
|
2.3 Insert Option at beginning of Options
|
|
PASS select2.options.length is 3
|
|
PASS select2.selectedIndex is 1
|
|
PASS select2.options[0].value is '0'
|
|
PASS select2.options[0].textContent is 'Z'
|
|
PASS select2.options[1].value is '1'
|
|
PASS select2.options[1].textContent is 'A'
|
|
PASS select2.options[2].value is '2'
|
|
PASS select2.options[2].textContent is 'B'
|
|
|
|
2.4 Insert Option in middle of Options
|
|
PASS select2.options.length is 4
|
|
PASS select2.selectedIndex is 1
|
|
PASS select2.options[0].value is '0'
|
|
PASS select2.options[0].textContent is 'Z'
|
|
PASS select2.options[1].value is '1'
|
|
PASS select2.options[1].textContent is 'A'
|
|
PASS select2.options[2].value is '1.5'
|
|
PASS select2.options[2].textContent is 'A.5'
|
|
PASS select2.options[3].value is '2'
|
|
PASS select2.options[3].textContent is 'B'
|
|
|
|
2.5 Insert Option at end of Options
|
|
PASS select2.options.length is 5
|
|
PASS select2.selectedIndex is 1
|
|
PASS select2.options[0].value is '0'
|
|
PASS select2.options[0].textContent is 'Z'
|
|
PASS select2.options[1].value is '1'
|
|
PASS select2.options[1].textContent is 'A'
|
|
PASS select2.options[2].value is '1.5'
|
|
PASS select2.options[2].textContent is 'A.5'
|
|
PASS select2.options[3].value is '2'
|
|
PASS select2.options[3].textContent is 'B'
|
|
PASS select2.options[4].value is '3'
|
|
PASS select2.options[4].textContent is 'C'
|
|
|
|
2.6 Insert Option beyond the end of Options
|
|
PASS select2.options.length is 6
|
|
PASS select2.selectedIndex is 1
|
|
PASS select2.options[0].value is '0'
|
|
PASS select2.options[0].textContent is 'Z'
|
|
PASS select2.options[1].value is '1'
|
|
PASS select2.options[1].textContent is 'A'
|
|
PASS select2.options[2].value is '1.5'
|
|
PASS select2.options[2].textContent is 'A.5'
|
|
PASS select2.options[3].value is '2'
|
|
PASS select2.options[3].textContent is 'B'
|
|
PASS select2.options[4].value is '3'
|
|
PASS select2.options[4].textContent is 'C'
|
|
PASS select2.options[5].value is '4'
|
|
PASS select2.options[5].textContent is 'D'
|
|
|
|
2.7 Add an Option at index -1
|
|
PASS select2.options.length is 7
|
|
PASS select2.selectedIndex is 1
|
|
PASS select2.options[0].value is '0'
|
|
PASS select2.options[0].textContent is 'Z'
|
|
PASS select2.options[1].value is '1'
|
|
PASS select2.options[1].textContent is 'A'
|
|
PASS select2.options[2].value is '1.5'
|
|
PASS select2.options[2].textContent is 'A.5'
|
|
PASS select2.options[3].value is '2'
|
|
PASS select2.options[3].textContent is 'B'
|
|
PASS select2.options[4].value is '3'
|
|
PASS select2.options[4].textContent is 'C'
|
|
PASS select2.options[5].value is '4'
|
|
PASS select2.options[5].textContent is 'D'
|
|
PASS select2.options[6].value is '5'
|
|
PASS select2.options[6].textContent is 'E'
|
|
|
|
2.8 Add an Option at index -2
|
|
PASS select2.options.add(option2, -2) did not throw exception.
|
|
PASS select2.options.length is 8
|
|
PASS select2.selectedIndex is 1
|
|
|
|
2.9 Add an Option at index -Infinity
|
|
PASS select2.options.add(option2, -1/0) did not throw exception.
|
|
PASS select2.options.length is 9
|
|
PASS select2.selectedIndex is 2
|
|
|
|
2.10 Add an Option at index NaN
|
|
PASS select2.options.add(option2, 0/0) did not throw exception.
|
|
PASS select2.options.length is 10
|
|
PASS select2.selectedIndex is 3
|
|
|
|
2.11 Add an Option at index Infinity
|
|
PASS select2.options.add(option2, 1/0) did not throw exception.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.12 Add a non-Option element
|
|
PASS select2.options.add(div, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.13 Add a non-element (string)
|
|
PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.14 Add a non-element (number)
|
|
PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.15 Add a non-element (boolean)
|
|
PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.16 Add undefined
|
|
PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.17 Add null
|
|
PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.18 Add negative infinity
|
|
PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.19 Add NaN
|
|
PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
2.20 Add positive infinity
|
|
PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
|
|
PASS select2.options.length is 11
|
|
PASS select2.selectedIndex is 4
|
|
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|