Commit a0873eea authored by xiaochengh's avatar xiaochengh Committed by Commit bot

Convert editing/pasteboard/5075944.html with assert_selection

This patch converts editing/pasteboard/5075944.html with assert_selection
to promote the use of w3c testharness and improve code health.

It is also a preparation for https://codereview.chromium.org/2626933002

BUG=679616, 679977

Review-Url: https://codereview.chromium.org/2621213002
Cr-Commit-Position: refs/heads/master@{#442820}
parent 293f4eec
<p>This test for a bug copy/pasting underlined text.</p>
<div id="copy" contenteditable="true">This should be underlined.</div>
<div id="paste" contenteditable="true"><br></div>
<script>
var copy = document.getElementById("copy");
copy.focus();
document.execCommand("SelectAll");
document.execCommand("Underline");
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>
test(() => {
assert_not_equals(
window.testRunner, undefined,
'This test requires testRunner.');
assert_selection(
[
'<div contenteditable>^foo bar baz.|</div>',
'<div contenteditable id="paste"><br></div>'
].join(''),
selection => {
const document = selection.document;
document.execCommand('underline');
document.execCommand('copy');
document.getElementById('paste').focus();
document.execCommand('paste');
},
[
'<div contenteditable><u>foo bar baz.</u></div>',
'<div contenteditable id="paste"><u>foo bar baz.|</u></div>'
].join(''));
}, 'Copy/paste underlined text.');
</script>
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow {P} at (0,0) size 784x20
LayoutText {#text} at (0,0) size 284x19
text run at (0,0) width 284: "This test for a bug copy/pasting underlined text."
LayoutBlockFlow {DIV} at (0,36) size 784x20
LayoutInline {U} at (0,0) size 157x19
LayoutText {#text} at (0,0) size 157x19
text run at (0,0) width 157: "This should be underlined."
LayoutBlockFlow {DIV} at (0,56) size 784x20
LayoutInline {U} at (0,0) size 157x19
LayoutText {#text} at (0,0) size 157x19
text run at (0,0) width 157: "This should be underlined."
caret: position 26 of child 0 {#text} of child 0 {U} of child 4 {DIV} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow {P} at (0,0) size 784x18
LayoutText {#text} at (0,0) size 307x18
text run at (0,0) width 307: "This test for a bug copy/pasting underlined text."
LayoutBlockFlow {DIV} at (0,34) size 784x18
LayoutInline {U} at (0,0) size 171x18
LayoutText {#text} at (0,0) size 171x18
text run at (0,0) width 171: "This should be underlined."
LayoutBlockFlow {DIV} at (0,52) size 784x18
LayoutInline {U} at (0,0) size 171x18
LayoutText {#text} at (0,0) size 171x18
text run at (0,0) width 171: "This should be underlined."
caret: position 26 of child 0 {#text} of child 0 {U} of child 4 {DIV} of body
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow {P} at (0,0) size 784x18
LayoutText {#text} at (0,0) size 307x17
text run at (0,0) width 307: "This test for a bug copy/pasting underlined text."
LayoutBlockFlow {DIV} at (0,34) size 784x18
LayoutInline {U} at (0,0) size 171x17
LayoutText {#text} at (0,0) size 171x17
text run at (0,0) width 171: "This should be underlined."
LayoutBlockFlow {DIV} at (0,52) size 784x18
LayoutInline {U} at (0,0) size 171x17
LayoutText {#text} at (0,0) size 171x17
text run at (0,0) width 171: "This should be underlined."
caret: position 26 of child 0 {#text} of child 0 {U} of child 4 {DIV} of body
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