blob: 677e0874dddd257bcec2094b5fe03a41d22e92ce [file] [log] [blame]
This test checks if setSelectionRange(), selectionStart, and selectionEnd on a textarea and input work as expected. This includes checking edge cases such as out-of-bound values.
If this test passed you'll see a bunch of correct selection ranges below. Check the expected file for the correct ranges.
===textarea===
setSelectionRange():
3, 7
0, 5
42, 48
2, 2
selectionStart:
3, 3
7, 7
0, 7
48, 48
3, 48
selectionEnd:
3, 5
2, 2
0, 0
0, 48
7, 7
selectionStart and selectionEnd in focus handler don't return wrong values 0,0:
7, 7
===input===
setSelectionRange():
3, 7
0, 5
42, 48
2, 2
selectionStart:
3, 3
7, 7
0, 7
48, 48
3, 48
selectionEnd:
3, 5
2, 2
0, 0
0, 48
7, 7
selectionStart and selectionEnd in focus handler don't return wrong values 0,0:
7, 7
===button===
button.selectionStart threw exception
button.selectionStart = 0 threw exception
button.selectionEnd threw exception
button.selectionEnd = 0 threw exception
button.setSelectionRange defined
button.setSelectionRange(0,0) threw exception