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

Convert editing/execCommand/4641880-2.html to use w3c test harness

This patch converts "editing/execCommand/4641880-2.html"
to use w3c test harness to simplify test script, and renames to
"indent_at_end_of_paragraph.html" to provide hint what this test script
verifies, for improving readability.

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

Review-Url: https://codereview.chromium.org/2267363005
Cr-Commit-Position: refs/heads/master@{#414308}
parent bc13dbaa
<p>This tests Indent on a selection that ends at the start of a paragraph. Since we don't paint the gap before the paragraph for most selections like this, we don't perform Indent on the paragraph that the selection ends in.</p>
<div id="div" contenteditable="true">
This paragraph should be indented.<br>
This paragraph should not be indented.</br>
</div>
<script>
if (window.testRunner)
window.testRunner.dumpEditingCallbacks();
var div = document.getElementById("div");
var sel = window.getSelection();
sel.collapse(div, 0);
sel.modify("extend", "forward", "line");
document.execCommand("Indent");
</script>
<!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>',
'^This paragraph should be indented.<br>|',
'This paragraph should not be indented.<br>',
'</div>',
].join(''),
'indent',
[
'<div contenteditable>',
'<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;">',
'^This paragraph should be indented.|',
'</blockquote>',
'This paragraph should not be indented.<br>',
'</div>',
].join('')),
'Indent on a selection that ends at the start of a paragraph.');
</script>
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
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 763x39
text run at (0,0) width 409: "This tests Indent on a selection that ends at the start of a paragraph. "
text run at (409,0) width 354: "Since we don't paint the gap before the paragraph for most"
text run at (0,20) width 521: "selections like this, we don't perform Indent on the paragraph that the selection ends in."
LayoutBlockFlow {DIV} at (0,56) size 784x40
LayoutBlockFlow {BLOCKQUOTE} at (40,0) size 744x20
LayoutText {#text} at (0,0) size 211x19
text run at (0,0) width 211: "This paragraph should be indented."
LayoutBlockFlow (anonymous) at (0,20) size 784x20
LayoutText {#text} at (0,0) size 234x19
text run at (0,0) width 234: "This paragraph should not be indented."
LayoutBR {BR} at (234,15) size 0x0
selection start: position 1 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of body
selection end: position 35 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of body
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
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 774x36
text run at (0,0) width 435: "This tests Indent on a selection that ends at the start of a paragraph. "
text run at (434,0) width 340: "Since we don't paint the gap before the paragraph for"
text run at (0,18) width 594: "most selections like this, we don't perform Indent on the paragraph that the selection ends in."
LayoutBlockFlow {DIV} at (0,52) size 784x36
LayoutBlockFlow {BLOCKQUOTE} at (40,0) size 744x18
LayoutText {#text} at (0,0) size 226x18
text run at (0,0) width 226: "This paragraph should be indented."
LayoutBlockFlow (anonymous) at (0,18) size 784x18
LayoutText {#text} at (0,0) size 250x18
text run at (0,0) width 250: "This paragraph should not be indented."
LayoutBR {BR} at (249,14) size 1x0
selection start: position 1 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of body
selection end: position 35 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of body
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
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 774x35
text run at (0,0) width 435: "This tests Indent on a selection that ends at the start of a paragraph. "
text run at (434,0) width 340: "Since we don't paint the gap before the paragraph for"
text run at (0,18) width 594: "most selections like this, we don't perform Indent on the paragraph that the selection ends in."
LayoutBlockFlow {DIV} at (0,52) size 784x36
LayoutBlockFlow {BLOCKQUOTE} at (40,0) size 744x18
LayoutText {#text} at (0,0) size 226x17
text run at (0,0) width 226: "This paragraph should be indented."
LayoutBlockFlow (anonymous) at (0,18) size 784x18
LayoutText {#text} at (0,0) size 250x17
text run at (0,0) width 250: "This paragraph should not be indented."
LayoutBR {BR} at (249,14) size 1x0
selection start: position 1 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of body
selection end: position 35 of child 0 {#text} of child 0 {BLOCKQUOTE} 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