Commit 581331a1 authored by yosin's avatar yosin Committed by Commit bot

Convert editing/pasteboard/displaced-{,generic-}placeholder.html.html to use w3c test harness

This patch converts "editing/pasteboard/displaced-{,generic-}placeholder.html"
to use w3c test harness to simplify test script, and consolidates into
"editing/inserting/insert_and_placeholder.html" since these test scripts
verifies "insertHTML" command with similar test sample, for improving code
health.

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

Review-Url: https://codereview.chromium.org/2341953005
Cr-Commit-Position: refs/heads/master@{#419131}
parent 19ff459a
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
'<div contenteditable>|<br></div>',
'insertHTML abc<div>def</div>',
'<div contenteditable>abc<div>def|</div></div>'),
'displaced generic placeholder');
// Note: Blink doesn't use class="webkit-block-placeholder" anymore.
test(() => assert_selection(
'<div contenteditable>|<br class="webkit-block-placeholder"></div>',
'insertHTML abc<div>def</div>',
'<div contenteditable>abc<div>def|</div></div>'),
'displaced placeholder with "class" attribute');
</script>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
</script>
<p>This is a test to make sure that a placeholder, even one that doesn't have our special class on it, is removed when it is displaced by pasted content.</p>
<div id="test" contenteditable="true"><br></div>
<script>
var s = window.getSelection();
var e = document.getElementById("test");
s.collapse(e, 0);
document.execCommand("InsertHTML", false, "First paragraph.<div>Second paragraph.</div>");
</script>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
</script>
<p>This is a test to make sure that a placeholder is removed when it is displaced by pasted content.</p>
<div id="test" contenteditable="true"><br class='webkit-block-placeholder'></div>
<script>
var s = window.getSelection();
var e = document.getElementById("test");
s.collapse(e, 0);
document.execCommand("InsertHTML", false, "First paragraph.<div>Second paragraph.</div>");
</script>
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 784x40
LayoutText {#text} at (0,0) size 780x39
text run at (0,0) width 780: "This is a test to make sure that a placeholder, even one that doesn't have our special class on it, is removed when it is displaced by"
text run at (0,20) width 92: "pasted content."
LayoutBlockFlow {DIV} at (0,56) size 784x40
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 96x19
text run at (0,0) width 96: "First paragraph."
LayoutBlockFlow {DIV} at (0,20) size 784x20
LayoutText {#text} at (0,0) size 115x19
text run at (0,0) width 115: "Second paragraph."
caret: position 17 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of body
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 573x19
text run at (0,0) width 573: "This is a test to make sure that a placeholder is removed when it is displaced by pasted content."
LayoutBlockFlow {DIV} at (0,36) size 784x40
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 96x19
text run at (0,0) width 96: "First paragraph."
LayoutBlockFlow {DIV} at (0,20) size 784x20
LayoutText {#text} at (0,0) size 115x19
text run at (0,0) width 115: "Second paragraph."
caret: position 17 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of body
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 784x36
LayoutText {#text} at (0,0) size 747x36
text run at (0,0) width 747: "This is a test to make sure that a placeholder, even one that doesn't have our special class on it, is removed when it is"
text run at (0,18) width 181: "displaced by pasted content."
LayoutBlockFlow {DIV} at (0,52) size 784x36
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 102x18
text run at (0,0) width 102: "First paragraph."
LayoutBlockFlow {DIV} at (0,18) size 784x18
LayoutText {#text} at (0,0) size 120x18
text run at (0,0) width 120: "Second paragraph."
caret: position 17 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of body
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 610x18
text run at (0,0) width 610: "This is a test to make sure that a placeholder is removed when it is displaced by pasted content."
LayoutBlockFlow {DIV} at (0,34) size 784x36
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 102x18
text run at (0,0) width 102: "First paragraph."
LayoutBlockFlow {DIV} at (0,18) size 784x18
LayoutText {#text} at (0,0) size 120x18
text run at (0,0) width 120: "Second paragraph."
caret: position 17 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of body
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 784x36
LayoutText {#text} at (0,0) size 747x35
text run at (0,0) width 747: "This is a test to make sure that a placeholder, even one that doesn't have our special class on it, is removed when it is"
text run at (0,18) width 181: "displaced by pasted content."
LayoutBlockFlow {DIV} at (0,52) size 784x36
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 102x17
text run at (0,0) width 102: "First paragraph."
LayoutBlockFlow {DIV} at (0,18) size 784x18
LayoutText {#text} at (0,0) size 120x17
text run at (0,0) width 120: "Second paragraph."
caret: position 17 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of body
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 610x17
text run at (0,0) width 610: "This is a test to make sure that a placeholder is removed when it is displaced by pasted content."
LayoutBlockFlow {DIV} at (0,34) size 784x36
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 102x17
text run at (0,0) width 102: "First paragraph."
LayoutBlockFlow {DIV} at (0,18) size 784x18
LayoutText {#text} at (0,0) size 120x17
text run at (0,0) width 120: "Second paragraph."
caret: position 17 of child 0 {#text} of child 1 {DIV} of child 2 {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