Commit 07fbfac9 authored by yosin's avatar yosin Committed by Commit bot

Convert editing/inserting/paragraph-separator-0[123].html to use w3c test harness

This patch converts "editing/inserting/paragraph-separator-0[123].html"
to use w3c test harness to simplify test script for improving readability, and
consolidates into "insert_paragraph_separator.html" since these files are
in same patch at beginning.

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

Review-Url: https://codereview.chromium.org/2287283002
Cr-Commit-Position: refs/heads/master@{#415198}
parent 29258004
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<div id="log"></div>
<script>
test(() => assert_selection(
'<div contenteditable>foo<br><div>|bar</div></div>',
'insertParagraph',
'<div contenteditable>foo<br><div><br></div><div>|bar</div></div>'),
'insert a paragraph separator after BR and before character');
test(() => assert_selection(
'<div contenteditable>foo<div>|bar</div></div>',
'insertParagraph',
'<div contenteditable>foo<div><br></div><div>|bar</div></div>'),
'insert a paragraph separator before character');
// A Test for a bug in the paragraph separator insertion code that would add an
// extra newline when inserting a paragraph separator at the end of a paragraph
// in text that preserves newlines. Also, an extraneous space would be added
// after 'foo'. Only one newline should be added. And there should be no
// extraneous spaces.
//
// It demonstrates a bug: too much padding is left between the new line and the
// end of the paragraph containing 'foo'.
test(() => assert_selection(
'<div contenteditable><pre>foo\n|bar</pre></div>',
'insertParagraph',
'<div contenteditable><pre>foo\n<br></pre><pre>|bar</pre></div>'),
'insert a paragraph separator in PRE');
</script>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
</script>
<p>Tests for a bug in the paragraph separator insertion code. Only one newline should be added.</p>
<div id="test" contenteditable="true">foo<br><div>bar</div></div>
<script type="text/javascript" src="../editing.js"></script>
<script>
if (window.internals)
internals.settings.setEditingBehavior("mac");
var e = document.getElementById("test");
var s = window.getSelection();
setSelectionCommand(e, 0, e, 0);
moveSelectionForwardByWordCommand();
insertParagraphCommand();
</script>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
</script>
<p>Tests for a bug in the paragraph separator insertion code. Only one newline should be added.</p>
<div id="test" contenteditable="true">foo<div>bar</div></div>
<script type="text/javascript" src="../editing.js"></script>
<script>
if (window.internals)
internals.settings.setEditingBehavior("mac");
var e = document.getElementById("test");
var s = window.getSelection();
setSelectionCommand(e, 0, e, 0);
moveSelectionForwardByWordCommand();
insertParagraphCommand();
</script>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
</script>
<p>Tests for a bug in the paragraph separator insertion code that would add an extra newline when inserting a paragraph separator at the end of a paragraph in text that preserves newlines. Also, an extraneous space would be added after 'foo'. Only one newline should be added. And there should be no extraneous spaces.</p>
<p><b>It demonstrates a bug:</b> too much padding is left between the new line and the end of the paragraph containing 'foo'.</p>
<div id="test" contenteditable="true"><pre>foo
bar</pre></div>
<script type="text/javascript" src="../editing.js"></script>
<script>
if (window.internals)
internals.settings.setEditingBehavior("mac");
var e = document.getElementById("test");
var s = window.getSelection();
setSelectionCommand(e, 0, e, 0);
moveSelectionForwardByWordCommand();
insertParagraphCommand();
</script>
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 784x20
LayoutText {#text} at (0,0) size 559x19
text run at (0,0) width 347: "Tests for a bug in the paragraph separator insertion code. "
text run at (346,0) width 213: "Only one newline should be added."
LayoutBlockFlow {DIV} at (0,36) size 784x60
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 20x19
text run at (0,0) width 20: "foo"
LayoutBlockFlow {DIV} at (0,20) size 784x40
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutBR {BR} at (0,0) size 0x19
LayoutBlockFlow {DIV} at (0,20) size 784x20
LayoutText {#text} at (0,0) size 20x19
text run at (0,0) width 20: "bar"
caret: position 0 of child 0 {BR} of child 1 {DIV} of child 2 {DIV} of body
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 784x20
LayoutText {#text} at (0,0) size 559x19
text run at (0,0) width 347: "Tests for a bug in the paragraph separator insertion code. "
text run at (346,0) width 213: "Only one newline should be added."
LayoutBlockFlow {DIV} at (0,36) size 784x60
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutText {#text} at (0,0) size 20x19
text run at (0,0) width 20: "foo"
LayoutBlockFlow {DIV} at (0,20) size 784x40
LayoutBlockFlow (anonymous) at (0,0) size 784x20
LayoutBR {BR} at (0,0) size 0x19
LayoutBlockFlow {DIV} at (0,20) size 784x20
LayoutText {#text} at (0,0) size 20x19
text run at (0,0) width 20: "bar"
caret: position 0 of child 0 {BR} of child 1 {DIV} 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 784x579
LayoutBlockFlow {P} at (0,0) size 784x60
LayoutText {#text} at (0,0) size 775x59
text run at (0,0) width 775: "Tests for a bug in the paragraph separator insertion code that would add an extra newline when inserting a paragraph separator at"
text run at (0,20) width 327: "the end of a paragraph in text that preserves newlines. "
text run at (327,20) width 329: "Also, an extraneous space would be added after 'foo'. "
text run at (656,20) width 104: "Only one newline"
text run at (0,40) width 108: "should be added. "
text run at (108,40) width 259: "And there should be no extraneous spaces."
LayoutBlockFlow {P} at (0,76) size 784x20
LayoutInline {B} at (0,0) size 150x19
LayoutText {#text} at (0,0) size 150x19
text run at (0,0) width 150: "It demonstrates a bug:"
LayoutText {#text} at (150,0) size 552x19
text run at (150,0) width 552: " too much padding is left between the new line and the end of the paragraph containing 'foo'."
LayoutBlockFlow {DIV} at (0,112) size 784x61
LayoutBlockFlow {PRE} at (0,0) size 784x16
LayoutText {#text} at (0,0) size 24x16
text run at (0,0) width 24: "foo"
LayoutBlockFlow {PRE} at (0,29) size 784x32
LayoutText {#text} at (0,0) size 24x32
text run at (0,0) width 0: " "
text run at (0,16) width 24: "bar"
caret: position 0 of child 0 {#text} of child 1 {PRE} of child 4 {DIV} of body
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 784x18
LayoutText {#text} at (0,0) size 593x18
text run at (0,0) width 368: "Tests for a bug in the paragraph separator insertion code. "
text run at (367,0) width 226: "Only one newline should be added."
LayoutBlockFlow {DIV} at (0,34) size 784x54
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 22x18
text run at (0,0) width 22: "foo"
LayoutBlockFlow {DIV} at (0,18) size 784x36
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutBR {BR} at (0,0) size 0x18
LayoutBlockFlow {DIV} at (0,18) size 784x18
LayoutText {#text} at (0,0) size 21x18
text run at (0,0) width 21: "bar"
caret: position 0 of child 0 {BR} of child 1 {DIV} of child 2 {DIV} of body
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 784x18
LayoutText {#text} at (0,0) size 593x18
text run at (0,0) width 368: "Tests for a bug in the paragraph separator insertion code. "
text run at (367,0) width 226: "Only one newline should be added."
LayoutBlockFlow {DIV} at (0,34) size 784x54
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 22x18
text run at (0,0) width 22: "foo"
LayoutBlockFlow {DIV} at (0,18) size 784x36
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutBR {BR} at (0,0) size 0x18
LayoutBlockFlow {DIV} at (0,18) size 784x18
LayoutText {#text} at (0,0) size 21x18
text run at (0,0) width 21: "bar"
caret: position 0 of child 0 {BR} of child 1 {DIV} 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 784x579
LayoutBlockFlow {P} at (0,0) size 784x54
LayoutText {#text} at (0,0) size 767x54
text run at (0,0) width 746: "Tests for a bug in the paragraph separator insertion code that would add an extra newline when inserting a paragraph"
text run at (0,18) width 427: "separator at the end of a paragraph in text that preserves newlines. "
text run at (426,18) width 341: "Also, an extraneous space would be added after 'foo'."
text run at (0,36) width 230: "Only one newline should be added. "
text run at (229,36) width 274: "And there should be no extraneous spaces."
LayoutBlockFlow {P} at (0,70) size 784x18
LayoutInline {B} at (0,0) size 155x18
LayoutText {#text} at (0,0) size 155x18
text run at (0,0) width 155: "It demonstrates a bug:"
LayoutText {#text} at (154,0) size 593x18
text run at (154,0) width 593: " too much padding is left between the new line and the end of the paragraph containing 'foo'."
LayoutBlockFlow {DIV} at (0,104) size 784x58
LayoutBlockFlow {PRE} at (0,0) size 784x15
LayoutText {#text} at (0,0) size 24x15
text run at (0,0) width 24: "foo"
LayoutBlockFlow {PRE} at (0,28) size 784x30
LayoutText {#text} at (0,0) size 24x30
text run at (0,0) width 0: " "
text run at (0,15) width 24: "bar"
caret: position 0 of child 0 {#text} of child 1 {PRE} of child 4 {DIV} of body
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 784x18
LayoutText {#text} at (0,0) size 593x17
text run at (0,0) width 368: "Tests for a bug in the paragraph separator insertion code. "
text run at (367,0) width 226: "Only one newline should be added."
LayoutBlockFlow {DIV} at (0,34) size 784x54
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 22x17
text run at (0,0) width 22: "foo"
LayoutBlockFlow {DIV} at (0,18) size 784x36
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutBR {BR} at (0,0) size 0x17
LayoutBlockFlow {DIV} at (0,18) size 784x18
LayoutText {#text} at (0,0) size 21x17
text run at (0,0) width 21: "bar"
caret: position 0 of child 0 {BR} of child 1 {DIV} of child 2 {DIV} of body
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 784x18
LayoutText {#text} at (0,0) size 593x17
text run at (0,0) width 368: "Tests for a bug in the paragraph separator insertion code. "
text run at (367,0) width 226: "Only one newline should be added."
LayoutBlockFlow {DIV} at (0,34) size 784x54
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutText {#text} at (0,0) size 22x17
text run at (0,0) width 22: "foo"
LayoutBlockFlow {DIV} at (0,18) size 784x36
LayoutBlockFlow (anonymous) at (0,0) size 784x18
LayoutBR {BR} at (0,0) size 0x17
LayoutBlockFlow {DIV} at (0,18) size 784x18
LayoutText {#text} at (0,0) size 21x17
text run at (0,0) width 21: "bar"
caret: position 0 of child 0 {BR} of child 1 {DIV} 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 784x579
LayoutBlockFlow {P} at (0,0) size 784x54
LayoutText {#text} at (0,0) size 767x53
text run at (0,0) width 746: "Tests for a bug in the paragraph separator insertion code that would add an extra newline when inserting a paragraph"
text run at (0,18) width 427: "separator at the end of a paragraph in text that preserves newlines. "
text run at (426,18) width 341: "Also, an extraneous space would be added after 'foo'."
text run at (0,36) width 230: "Only one newline should be added. "
text run at (229,36) width 274: "And there should be no extraneous spaces."
LayoutBlockFlow {P} at (0,70) size 784x18
LayoutInline {B} at (0,0) size 155x17
LayoutText {#text} at (0,0) size 155x17
text run at (0,0) width 155: "It demonstrates a bug:"
LayoutText {#text} at (154,0) size 593x17
text run at (154,0) width 593: " too much padding is left between the new line and the end of the paragraph containing 'foo'."
LayoutBlockFlow {DIV} at (0,104) size 784x61
LayoutBlockFlow {PRE} at (0,0) size 784x16
LayoutText {#text} at (0,0) size 24x16
text run at (0,0) width 24: "foo"
LayoutBlockFlow {PRE} at (0,29) size 784x32
LayoutText {#text} at (0,0) size 24x32
text run at (0,0) width 0: " "
text run at (0,16) width 24: "bar"
caret: position 0 of child 0 {#text} of child 1 {PRE} 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