OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <body> |
| 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 |
| 6 <input> |
| 7 |
| 8 <script> |
| 9 var t = async_test('selectionStart/selectionEnd should be kept after input type
changes.'); |
| 10 t.step(() => { |
| 11 assert_exists(window, 'eventSender'); |
| 12 var element = document.querySelector('input'); |
| 13 element.value = ''; |
| 14 element.focus(); |
| 15 eventSender.keyDown('c'); |
| 16 assert_equals(element.selectionStart, 1); |
| 17 element.type = 'button'; |
| 18 assert_equals(element.selectionStart, null); |
| 19 element.type = 'text'; |
| 20 |
| 21 // TODO(tkent): We need some delay before checking selectionStart because |
| 22 // input type change doesn't update selectionStart immediately to avoid force |
| 23 // layout. crbug.com/721217 |
| 24 t.step_timeout(() => { |
| 25 assert_equals(element.selectionStart, 1); |
| 26 t.done(); |
| 27 }, 1); |
| 28 }); |
| 29 </script> |
| 30 </body> |
OLD | NEW |