OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <input id="val1" type="text" /> |
| 8 <input id="val2" type="text" /> |
| 9 <script type="text/javascript"> |
| 10 description('Test for BUG=367736: Blink does not respect input.selectionStart an
d input.selectionEnd for some cases.'); |
| 11 var firstInput = document.getElementById('val1'); |
| 12 var secondInput = document.getElementById('val2'); |
| 13 firstInput.selectionStart = 2; |
| 14 firstInput.selectionEnd = 3; |
| 15 // Initially input field is empty so selectionStart and selectionEnd set above b
ecomes 0 |
| 16 firstInput.value = 'Parsed'; |
| 17 shouldBe('firstInput.selectionStart', '0'); |
| 18 shouldBe('firstInput.selectionEnd', '0'); |
| 19 firstInput.selectionStart = 3; |
| 20 firstInput.selectionEnd = 5; |
| 21 shouldBe('firstInput.selectionStart', '3'); |
| 22 shouldBe('firstInput.selectionEnd', '5'); |
| 23 secondInput.value = 'P'; |
| 24 secondInput.selectionStart = 3; |
| 25 secondInput.selectionEnd = 5; |
| 26 shouldBe('secondInput.selectionStart', '1'); |
| 27 shouldBe('secondInput.selectionEnd', '1'); |
| 28 secondInput.value = 'Parsed'; |
| 29 shouldBe('secondInput.selectionStart', '1'); |
| 30 shouldBe('secondInput.selectionEnd', '1'); |
| 31 </script> |
| 32 </body> |
| 33 </html> |
OLD | NEW |