Commit a267f965 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() in editing/pasteboard/5071074.html

This patch changes "5071074.html" to utilize |selection_test()| and renames to
"copy_and_paste_with_anchor_text.html" for ease of maintenance and enabling
EditingNG.

Bug: 679977, 707656
Change-Id: I002cb140f497fde0b07b027aee9f50f359f2a140
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2262080Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781727}
parent 4282e208
<p>This tests for a bug where links that weren't fully selected would be copy/pasted as plain text.</p>
<div id="copy">This should be plain text. <a id="anchor" href="http://www.google.com/">This should be a link.</a> This should be plain text.</div>
<div id="paste" contenteditable="true"><br></div>
<script>
var anchor = document.getElementById("anchor");
var sel = window.getSelection();
var range = document.createRange();
range.selectNodeContents(anchor);
sel.addRange(range);
document.execCommand("Copy");
var paste = document.getElementById("paste");
paste.focus();
document.execCommand("Paste");
</script>
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// Tetsts for Copy & Paste of anchor text as link instead of plain text.
// Note: Blink used to be copy and paste anchor text as plain text.
selection_test(
[
'<div>',
'abc ',
'<a href="http://www.google.com/">^XYZ|</a>',
'def',
'</div>',
'<div contenteditable id="paste"><br></div>',
],
selection => {
if (!window.testRunner)
throw 'This test requires testRunner.';
selection.document.execCommand('copy');
selection.document.getElementById('paste').focus();
selection.document.execCommand('paste');
},
[
'<div>',
'abc ',
'<a href="http://www.google.com/">XYZ</a>',
'def',
'</div>',
'<div contenteditable id="paste">',
'<a href="http://www.google.com/">XYZ|</a>',
'</div>',
],
'Copy & Paste fully selected anchor text');
selection_test(
[
'<div>',
'abc ',
'<a href="http://www.google.com/">X^Y|Z</a>',
'def',
'</div>',
'<div contenteditable id="paste"><br></div>',
],
selection => {
if (!window.testRunner)
throw 'This test requires testRunner.';
selection.document.execCommand('copy');
selection.document.getElementById('paste').focus();
selection.document.execCommand('paste');
},
[
'<div>',
'abc ',
'<a href="http://www.google.com/">XYZ</a>',
'def',
'</div>',
'<div contenteditable id="paste">',
'<a href="http://www.google.com/">Y|</a>',
'</div>',
],
'Copy & Paste partially selected anchor text');
</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