blob: 812bf98e7664348e408c7f716d22e782fc220bd8 [file] [log] [blame]
Test setRangeText() method on textareas.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Running tests on textarea with attributes: {}
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 textareas doesn't affect scroll position.
element.value = longString
element.scrollTop = 0
element.setSelectionRange(100, 110)
element.setRangeText('A', 9999, 9999, 'select')
PASS element.value is longString+'A'
PASS element.selectionStart is longString.length
PASS element.selectionEnd is longString.length+1
PASS element.scrollTop is 0
Running tests on textarea with attributes: {"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..
PASS successfullyParsed is true
TEST COMPLETE