Commit 8104e686 authored by yosin's avatar yosin Committed by Commit bot

Convert editing/selection/5497643.html to use assert_selection()

This patch converts "editing/selection/5497643.html" to use |assert_selection()|
to simplify test case and renames to "after-removing-textarea.html" to provide
a hint what this test verifies for improving code health.

BUG=n/a
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2441363002
Cr-Commit-Position: refs/heads/master@{#427215}
parent 7adee5e6
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<p>This tests to make sure that a selection inside a textarea is updated when the textarea is removed from the document.</p>
<textarea id="textarea"></textarea>
<div id="log"></div>
<script>
textarea = document.getElementById("textarea");
textarea.setSelectionRange(0, 0);
textarea.focus();
textarea.parentNode.removeChild(textarea);
test(function() {
assert_equals(window.getSelection().type, 'Caret');
assert_equals(window.getSelection().getRangeAt(0).startContainer, document.body);
assert_equals(window.getSelection().getRangeAt(0).startOffset, 2);
});
</script>
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
'before<textarea>|</textarea>after',
selection => {
selection.document.querySelector('textarea').remove();
},
'before|after'),
'We should have caret after removing TEXTAREA');
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment