chromium/third_party/blink/web_tests/fast/forms/text-control-selection-after-blur.html

<!DOCTYPE html>
<title>Tests for crbug.com/714425</title>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<input>
<textarea></textarea>

<script>
function testSelectionAfterBlur(element) {
  test(() => {
    assert_own_property(window, 'eventSender');
    element.value = '';
    element.focus();
    eventSender.keyDown('a');
    eventSender.keyDown('b');
    eventSender.keyDown('Backspace');
    assert_equals(element.selectionStart, 1, 'selectionStart before blur');
    assert_equals(element.selectionEnd, 1, 'selectionEnd before blur');
    element.blur();
    assert_equals(element.selectionStart, 1, 'selectionStart after blur');
    assert_equals(element.selectionEnd, 1, 'selectionEnd after blur');
  }, `${element.tagName}: selectionStart/selectionEnd should be correct after blur()`);
}

testSelectionAfterBlur(document.querySelector('input'));
testSelectionAfterBlur(document.querySelector('textarea'));
</script>
</body>