blob: fd1dd4fcb178646b82e62ac4bde98e786b1fec6e [file] [log] [blame]
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// Regression tests for crbug.com/713607.
test(() => {
assert_own_property(window, 'eventSender', 'This test requires eventSender');
assert_selection(
[
'<textarea>^text|</textarea>',
'<a href="http://www.example.com/">link</a>'
].join(''),
selection => {
const link = selection.document.querySelector('a');
link.focus();
eventSender.keyDown('ArrowLeft');
assert_equals(selection.document.activeElement, link);
},
[
'|<textarea>text</textarea>',
'<a href="http://www.example.com/">link</a>'
].join(''));
}, 'Press left arrow key with unfocused selection in text control');
test(() => {
assert_own_property(window, 'eventSender', 'This test requires eventSender');
assert_selection(
[
'<div contenteditable>^text|</div>',
'<a href="http://www.example.com/">link</a>'
].join(''),
selection => {
const link = selection.document.querySelector('a');
link.focus();
eventSender.keyDown('ArrowLeft');
assert_equals(selection.document.activeElement, link);
},
[
'<div contenteditable>^text|</div>',
'<a href="http://www.example.com/">link</a>'
].join(''));
}, 'Press left arrow key with unfocused selection in contenteditable div');
</script>