| <!DOCTYPE html> |
| <body> |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| |
| <input> |
| |
| <script> |
| var t = async_test('selectionStart/selectionEnd should be kept after input type changes.'); |
| t.step(() => { |
| assert_exists(window, 'eventSender'); |
| var element = document.querySelector('input'); |
| element.value = ''; |
| element.focus(); |
| eventSender.keyDown('c'); |
| assert_equals(element.selectionStart, 1); |
| element.type = 'button'; |
| assert_equals(element.selectionStart, null); |
| element.type = 'text'; |
| |
| // TODO(tkent): We need some delay before checking selectionStart because |
| // input type change doesn't update selectionStart immediately to avoid force |
| // layout. crbug.com/721217 |
| t.step_timeout(() => { |
| assert_equals(element.selectionStart, 1); |
| t.done(); |
| }, 1); |
| }); |
| </script> |
| </body> |