blob: 3f21239d823804aa4b8b6347b3547b000ad2440f [file] [log] [blame]
Test setRangeText() method on common input types.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Running tests on input with attributes: {"type":"password"}
setRangeText() with only one parameter.
element.value = '0123456789'
element.setSelectionRange(2, 5)
element.setRangeText('ABC')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.setRangeText('ABCD')
PASS element.value is "01ABCD56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 6
element.setRangeText('AB')
PASS element.value is "01AB56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 4
element.setRangeText('')
PASS element.value is "0156789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'select' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 5, 'select')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 5, 10, 'select')
PASS element.value is "01234ABC"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 1, 2, 'select')
PASS element.value is "0ABC23456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('', 1, 9, 'select')
PASS element.value is "09"
PASS element.selectionStart is 1
PASS element.selectionEnd is 1
setRangeText() with 'start' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 6, 'start')
PASS element.value is "01ABC6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'end' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 10, 10, 'end')
PASS element.value is "0123456789ABC"
PASS element.selectionStart is 13
PASS element.selectionEnd is 13
setRangeText() with 'preserve' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 2)
PASS element.value is "0A23456789"
PASS element.selectionStart is 6
PASS element.selectionEnd is 9
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('AB', 1, 1, 'invalid')
PASS element.value is "0AB123456789"
PASS element.selectionStart is 8
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 3, 'preserve')
PASS element.value is "0A3456789"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 1, 4, 'preserve')
PASS element.value is "0A456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 4, 6, 'preserve')
PASS element.value is "0123A6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('ABCDEF', 4, 7, 'preserve')
PASS element.value is "0123ABCDEF789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 10
setRangeText() with various start/end values.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 100, 100, 'select')
PASS element.value is "0123456789A"
PASS element.selectionStart is 10
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 8, 100, 'select')
PASS element.value is "01234567A"
PASS element.selectionStart is 8
PASS element.selectionEnd is 9
element.value = '0123456789'
PASS element.setRangeText('A', 7, 3) threw exception IndexSizeError: The index is not in the allowed range..
Running tests on input with attributes: {"type":"tel"}
setRangeText() with only one parameter.
element.value = '0123456789'
element.setSelectionRange(2, 5)
element.setRangeText('ABC')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.setRangeText('ABCD')
PASS element.value is "01ABCD56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 6
element.setRangeText('AB')
PASS element.value is "01AB56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 4
element.setRangeText('')
PASS element.value is "0156789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'select' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 5, 'select')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 5, 10, 'select')
PASS element.value is "01234ABC"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 1, 2, 'select')
PASS element.value is "0ABC23456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('', 1, 9, 'select')
PASS element.value is "09"
PASS element.selectionStart is 1
PASS element.selectionEnd is 1
setRangeText() with 'start' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 6, 'start')
PASS element.value is "01ABC6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'end' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 10, 10, 'end')
PASS element.value is "0123456789ABC"
PASS element.selectionStart is 13
PASS element.selectionEnd is 13
setRangeText() with 'preserve' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 2)
PASS element.value is "0A23456789"
PASS element.selectionStart is 6
PASS element.selectionEnd is 9
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('AB', 1, 1, 'invalid')
PASS element.value is "0AB123456789"
PASS element.selectionStart is 8
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 3, 'preserve')
PASS element.value is "0A3456789"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 1, 4, 'preserve')
PASS element.value is "0A456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 4, 6, 'preserve')
PASS element.value is "0123A6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('ABCDEF', 4, 7, 'preserve')
PASS element.value is "0123ABCDEF789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 10
setRangeText() with various start/end values.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 100, 100, 'select')
PASS element.value is "0123456789A"
PASS element.selectionStart is 10
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 8, 100, 'select')
PASS element.value is "01234567A"
PASS element.selectionStart is 8
PASS element.selectionEnd is 9
element.value = '0123456789'
PASS element.setRangeText('A', 7, 3) threw exception IndexSizeError: The index is not in the allowed range..
Running tests on input with attributes: {"type":"text"}
setRangeText() with only one parameter.
element.value = '0123456789'
element.setSelectionRange(2, 5)
element.setRangeText('ABC')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.setRangeText('ABCD')
PASS element.value is "01ABCD56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 6
element.setRangeText('AB')
PASS element.value is "01AB56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 4
element.setRangeText('')
PASS element.value is "0156789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'select' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 5, 'select')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 5, 10, 'select')
PASS element.value is "01234ABC"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 1, 2, 'select')
PASS element.value is "0ABC23456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('', 1, 9, 'select')
PASS element.value is "09"
PASS element.selectionStart is 1
PASS element.selectionEnd is 1
setRangeText() with 'start' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 6, 'start')
PASS element.value is "01ABC6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'end' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 10, 10, 'end')
PASS element.value is "0123456789ABC"
PASS element.selectionStart is 13
PASS element.selectionEnd is 13
setRangeText() with 'preserve' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 2)
PASS element.value is "0A23456789"
PASS element.selectionStart is 6
PASS element.selectionEnd is 9
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('AB', 1, 1, 'invalid')
PASS element.value is "0AB123456789"
PASS element.selectionStart is 8
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 3, 'preserve')
PASS element.value is "0A3456789"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 1, 4, 'preserve')
PASS element.value is "0A456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 4, 6, 'preserve')
PASS element.value is "0123A6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('ABCDEF', 4, 7, 'preserve')
PASS element.value is "0123ABCDEF789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 10
setRangeText() with various start/end values.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 100, 100, 'select')
PASS element.value is "0123456789A"
PASS element.selectionStart is 10
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 8, 100, 'select')
PASS element.value is "01234567A"
PASS element.selectionStart is 8
PASS element.selectionEnd is 9
element.value = '0123456789'
PASS element.setRangeText('A', 7, 3) threw exception IndexSizeError: The index is not in the allowed range..
Running tests on input with attributes: {"type":"text","dir":"rtl"}
setRangeText() with only one parameter.
element.value = '0123456789'
element.setSelectionRange(2, 5)
element.setRangeText('ABC')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.setRangeText('ABCD')
PASS element.value is "01ABCD56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 6
element.setRangeText('AB')
PASS element.value is "01AB56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 4
element.setRangeText('')
PASS element.value is "0156789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'select' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 5, 'select')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 5, 10, 'select')
PASS element.value is "01234ABC"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 1, 2, 'select')
PASS element.value is "0ABC23456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('', 1, 9, 'select')
PASS element.value is "09"
PASS element.selectionStart is 1
PASS element.selectionEnd is 1
setRangeText() with 'start' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 6, 'start')
PASS element.value is "01ABC6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'end' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 10, 10, 'end')
PASS element.value is "0123456789ABC"
PASS element.selectionStart is 13
PASS element.selectionEnd is 13
setRangeText() with 'preserve' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 2)
PASS element.value is "0A23456789"
PASS element.selectionStart is 6
PASS element.selectionEnd is 9
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('AB', 1, 1, 'invalid')
PASS element.value is "0AB123456789"
PASS element.selectionStart is 8
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 3, 'preserve')
PASS element.value is "0A3456789"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 1, 4, 'preserve')
PASS element.value is "0A456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 4, 6, 'preserve')
PASS element.value is "0123A6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('ABCDEF', 4, 7, 'preserve')
PASS element.value is "0123ABCDEF789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 10
setRangeText() with various start/end values.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 100, 100, 'select')
PASS element.value is "0123456789A"
PASS element.selectionStart is 10
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 8, 100, 'select')
PASS element.value is "01234567A"
PASS element.selectionStart is 8
PASS element.selectionEnd is 9
element.value = '0123456789'
PASS element.setRangeText('A', 7, 3) threw exception IndexSizeError: The index is not in the allowed range..
Running tests on input with attributes: {"type":"url"}
setRangeText() with only one parameter.
element.value = '0123456789'
element.setSelectionRange(2, 5)
element.setRangeText('ABC')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.setRangeText('ABCD')
PASS element.value is "01ABCD56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 6
element.setRangeText('AB')
PASS element.value is "01AB56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 4
element.setRangeText('')
PASS element.value is "0156789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'select' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 5, 'select')
PASS element.value is "01ABC56789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 5, 10, 'select')
PASS element.value is "01234ABC"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 1, 2, 'select')
PASS element.value is "0ABC23456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('', 1, 9, 'select')
PASS element.value is "09"
PASS element.selectionStart is 1
PASS element.selectionEnd is 1
setRangeText() with 'start' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 2, 6, 'start')
PASS element.value is "01ABC6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 2
setRangeText() with 'end' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('ABC', 10, 10, 'end')
PASS element.value is "0123456789ABC"
PASS element.selectionStart is 13
PASS element.selectionEnd is 13
setRangeText() with 'preserve' as the selectMode.
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 2)
PASS element.value is "0A23456789"
PASS element.selectionStart is 6
PASS element.selectionEnd is 9
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('AB', 1, 1, 'invalid')
PASS element.value is "0AB123456789"
PASS element.selectionStart is 8
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(6, 9)
element.setRangeText('A', 1, 3, 'preserve')
PASS element.value is "0A3456789"
PASS element.selectionStart is 5
PASS element.selectionEnd is 8
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 1, 4, 'preserve')
PASS element.value is "0A456789"
PASS element.selectionStart is 1
PASS element.selectionEnd is 4
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('A', 4, 6, 'preserve')
PASS element.value is "0123A6789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 5
element.value = '0123456789'
element.setSelectionRange(2, 6)
element.setRangeText('ABCDEF', 4, 7, 'preserve')
PASS element.value is "0123ABCDEF789"
PASS element.selectionStart is 2
PASS element.selectionEnd is 10
setRangeText() with various start/end values.
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 100, 100, 'select')
PASS element.value is "0123456789A"
PASS element.selectionStart is 10
PASS element.selectionEnd is 11
element.value = '0123456789'
element.setSelectionRange(0, 0)
element.setRangeText('A', 8, 100, 'select')
PASS element.value is "01234567A"
PASS element.selectionStart is 8
PASS element.selectionEnd is 9
element.value = '0123456789'
PASS element.setRangeText('A', 7, 3) threw exception IndexSizeError: The index is not in the allowed range..
Check that setRangeText() on disconnected elements doesn't crash and has proper values.
element.value = '0123456789'
element.setRangeText('ABC', 0, 0, 'select')
FAIL element.value should be ABC0123456789. Was 0123456789.
Running tests on input with attributes: {"type":"button"}
element.value = '0123456789XYZ'
PASS element.setRangeText('ABC', 0, 0) threw exception InvalidStateError: The object is in an invalid state..
PASS element.value is "0123456789XYZ"
Running tests on input with attributes: {"type":"checkbox"}
element.value = '0123456789XYZ'
PASS element.setRangeText('ABC', 0, 0) threw exception InvalidStateError: The object is in an invalid state..
PASS element.value is "0123456789XYZ"
Running tests on input with attributes: {"type":"email"}
element.value = '0123456789XYZ'
PASS element.setRangeText('ABC', 0, 0) threw exception InvalidStateError: The object is in an invalid state..
PASS element.value is "0123456789XYZ"
Running tests on input with attributes: {"type":"radio"}
element.value = '0123456789XYZ'
PASS element.setRangeText('ABC', 0, 0) threw exception InvalidStateError: The object is in an invalid state..
PASS element.value is "0123456789XYZ"
Running tests on input with attributes: {"type":"reset"}
element.value = '0123456789XYZ'
PASS element.setRangeText('ABC', 0, 0) threw exception InvalidStateError: The object is in an invalid state..
PASS element.value is "0123456789XYZ"
Running tests on input with attributes: {"type":"submit"}
element.value = '0123456789XYZ'
PASS element.setRangeText('ABC', 0, 0) threw exception InvalidStateError: The object is in an invalid state..
PASS element.value is "0123456789XYZ"
PASS successfullyParsed is true
TEST COMPLETE