Commit b5bc3aa8 authored by yosin's avatar yosin Committed by Commit bot

Convert editing/pasteboard/3976872.html to use w3c test harness

This patch converts "editing/pasteboard/3976872.html" to use w3c test harness to
simplify test script, and renames to "paste_plain_text_to_newlines.html" to
provide a hint what this test script verifies, for improving code health.

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

Review-Url: https://codereview.chromium.org/2344563004
Cr-Commit-Position: refs/heads/master@{#419116}
parent ff1792ac
<html>
<head>
<style>
.editing {
border: 1px solid red;
}
</style>
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
function editingTest() {
extendSelectionForwardByLineCommand();
copyCommand();
boldCommand();
moveSelectionBackwardByCharacterCommand();
insertParagraphCommand();
moveSelectionBackwardByCharacterCommand();
pasteAndMatchStyleCommand();
}
</script>
<title>Paste and match style on an empty (but styled) line</title>
</head>
<body>
<p>This tests paste and match style on an empty (but styled) line</p>
<p>The first line is copied (unstyled), then it's bolded, then a paragraph separator is inserted and the original unstyled line is pasted (with style matching).</p>
<hr>
<div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space;">
<div id="test" class="editing">this text should end up bold</div>
</div>
<script>
runEditingTest();
</script>
</body>
</html>
<!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.internals, undefined,
'This test requires window.internals to access clipboard');
assert_selection(
'<div contenteditable><b>|<br></b></div>',
selection => {
selection.setClipboardData('abc');
selection.document.execCommand('pasteAndMatchStyle');
},
'<div contenteditable><b>abc|</b></div>',
'pasteAndMatchStyle');
});
</script>
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
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 363x19
text run at (0,0) width 363: "This tests paste and match style on an empty (but styled) line"
LayoutBlockFlow {P} at (0,36) size 784x40
LayoutText {#text} at (0,0) size 756x39
text run at (0,0) width 756: "The first line is copied (unstyled), then it's bolded, then a paragraph separator is inserted and the original unstyled line is pasted"
text run at (0,20) width 127: "(with style matching)."
LayoutBlockFlow {HR} at (0,92) size 784x2 [border: (1px inset #EEEEEE)]
LayoutBlockFlow {DIV} at (0,102) size 784x44
LayoutBlockFlow {DIV} at (0,0) size 784x22 [border: (1px solid #FF0000)]
LayoutInline {B} at (0,0) size 181x19
LayoutText {#text} at (1,1) size 181x19
text run at (1,1) width 181: "this text should end up bold"
LayoutBlockFlow {DIV} at (0,22) size 784x22 [border: (1px solid #FF0000)]
LayoutInline {B} at (0,0) size 181x19
LayoutText {#text} at (1,1) size 181x19
text run at (1,1) width 181: "this text should end up bold"
caret: position 28 of child 0 {#text} of child 0 {B} of child 1 {DIV} of child 7 {DIV} of body
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
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 391x18
text run at (0,0) width 391: "This tests paste and match style on an empty (but styled) line"
LayoutBlockFlow {P} at (0,34) size 784x36
LayoutText {#text} at (0,0) size 769x36
text run at (0,0) width 769: "The first line is copied (unstyled), then it's bolded, then a paragraph separator is inserted and the original unstyled line is"
text run at (0,18) width 186: "pasted (with style matching)."
LayoutBlockFlow {HR} at (0,86) size 784x2 [border: (1px inset #EEEEEE)]
LayoutBlockFlow {DIV} at (0,96) size 784x40
LayoutBlockFlow {DIV} at (0,0) size 784x20 [border: (1px solid #FF0000)]
LayoutInline {B} at (0,0) size 189x18
LayoutText {#text} at (1,1) size 189x18
text run at (1,1) width 189: "this text should end up bold"
LayoutBlockFlow {DIV} at (0,20) size 784x20 [border: (1px solid #FF0000)]
LayoutInline {B} at (0,0) size 189x18
LayoutText {#text} at (1,1) size 189x18
text run at (1,1) width 189: "this text should end up bold"
caret: position 28 of child 0 {#text} of child 0 {B} of child 1 {DIV} of child 7 {DIV} of body
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
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 391x17
text run at (0,0) width 391: "This tests paste and match style on an empty (but styled) line"
LayoutBlockFlow {P} at (0,34) size 784x36
LayoutText {#text} at (0,0) size 770x35
text run at (0,0) width 770: "The first line is copied (unstyled), then it's bolded, then a paragraph separator is inserted and the original unstyled line is"
text run at (0,18) width 186: "pasted (with style matching)."
LayoutBlockFlow {HR} at (0,86) size 784x2 [border: (1px inset #EEEEEE)]
LayoutBlockFlow {DIV} at (0,96) size 784x40
LayoutBlockFlow {DIV} at (0,0) size 784x20 [border: (1px solid #FF0000)]
LayoutInline {B} at (0,0) size 189x17
LayoutText {#text} at (1,1) size 189x17
text run at (1,1) width 189: "this text should end up bold"
LayoutBlockFlow {DIV} at (0,20) size 784x20 [border: (1px solid #FF0000)]
LayoutInline {B} at (0,0) size 189x17
LayoutText {#text} at (1,1) size 189x17
text run at (1,1) width 189: "this text should end up bold"
caret: position 28 of child 0 {#text} of child 0 {B} of child 1 {DIV} of child 7 {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