Commit 6269bf67 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() in editing/execCommand/execCommand/forward-delete-no-scroll.html

This patch changes "execCommand/forward-delete-no-scroll.html" to utilize
|selection_test()| for ease of maintenance and help to implementing EditingNG.

Bug: 707656, 679977
Change-Id: Ia3f5aa974cffc9665b2074e812304b4ba9d428ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2208845
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770508}
parent 93234594
Matching other execCommand identifiers, execCommand("ForwardDelete") should not scroll the page to make selection visible.
This test only works in WebKit, as other engines do not implement this command.
SUCCESS
<p>Matching other execCommand identifiers, execCommand("ForwardDelete") should not scroll the page to make selection visible.</p> <!DOCTYPE html>
<p>This test only works in WebKit, as other engines do not implement this command.</p> <script src="../../resources/testharness.js"></script>
<div contenteditable>a</div> <script src="../../resources/testharnessreport.js"></script>
<div style="height:10000"></div> <script src="../assert_selection.js"></script>
<script> <script>
var text = document.getElementsByTagName('div')[0].firstChild; // Matching other execCommand identifiers, execCommand("ForwardDelete") should
window.getSelection().setBaseAndExtent(text, 0, text, 0); // not scroll the page to make selection visible.
window.scrollTo(0, 1000); selection_test(
document.execCommand("ForwardDelete"); [
'<div contenteditable>a|x</div>',
var result = (window.pageYOffset == 1000) ? "SUCCESS" : "FAILURE"; '<div style="height:10000"></div>',
if (window.testRunner) { ],
testRunner.dumpAsText(); selection => {
document.write(result); if (!selection.document.queryCommandEnabled('ForwardDelete'))
} else throw 'This test requires "ForwardDelete" command.';
alert(result); selection.window.scrollTo(0, 1000);
const pageYOffset = selection.window.pageYOffset;
selection.document.execCommand('ForwardDelete');
assert_equals(selection.window.pageYOffset, 1000, 'window.pageYOffset');
},
[
'<div contenteditable>a|</div>',
'<div style="height:10000"></div>',
]);
</script> </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