Commit 6e49adc6 authored by yosin's avatar yosin Committed by Commit bot

Convert editing/inserting/insert-at-end-0[12].html to use w3c test harness

This patch converts "editing/inserting/insert-at-end-0[12].html" to use w3c test
harness to simplify test script, and consolidates into "insert_at_end.html"
since these scripts use similar sample, for improving code health.

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

Review-Url: https://codereview.chromium.org/2339853002
Cr-Commit-Position: refs/heads/master@{#418820}
parent 410f515e
<html>
<head>
<link rel="stylesheet" href="../editingStyle.css">
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
function editingTest() {
moveSelectionForwardByLineCommand();
moveSelectionForwardByLineCommand();
moveSelectionForwardByLineCommand();
moveSelectionForwardByLineCommand();
typeCharacterCommand();
}
</script>
<title>Editing Test</title>
</head>
<body>
<p>This tests the visual position at the end of an editable block.</p>
<p>When the document ended with a &lt;br&gt;, there were visual positions at both [br, 0] and [br, 1]. This would produce inconsistent behavior when editing at the end of a document.</p>
<div contenteditable id="test" class="editing">
<div>paragraph one</div>
<div>paragraph two</div>
<br></div>
<script>runEditingTest();</script>
</body></html>
<html>
<head>
<link rel="stylesheet" href="../editingStyle.css">
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
<script>
function editingTest() {
moveSelectionForwardByLineCommand();
moveSelectionForwardByLineCommand();
moveSelectionForwardByLineCommand();
moveSelectionForwardByLineCommand();
typeCharacterCommand();
}
</script>
<title>Editing Test</title>
</head>
<body>
<p>This tests the visual position at the end of an editable block.</p>
<p>When the document ended with a &lt;br&gt;, there were visual positions at both [br, 0] and [br, 1]. This would produce inconsistent behavior when editing at the end of a document.</p>
<div contenteditable id="test" class="editing">
<div>paragraph one</div>
<div>paragraph two</div>
<br>
</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_selection(
[
'<div contenteditable>',
'<div>one</div>',
'<div>two</div>',
'|<br>',
'</div>',
].join(''),
'insertText abc',
[
'<div contenteditable>',
'<div>one</div>',
'<div>two</div>',
'abc|',
'</div>',
].join('')),
'insertText at end before BR');
test(() => assert_selection(
[
'<div contenteditable>',
'<div>one</div>',
'<div>two</div>',
'|<br>\n',
'</div>',
].join(''),
'insertText abc',
[
'<div contenteditable>',
'<div>one</div>',
'<div>two</div>',
'abc|\n',
'</div>',
].join('')),
'insertText at end before newline');
</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 784x20
LayoutText {#text} at (0,0) size 356x19
text run at (0,0) width 356: "This tests the visual position at the end of an editable block."
LayoutBlockFlow {P} at (0,36) size 784x40
LayoutText {#text} at (0,0) size 761x39
text run at (0,0) width 568: "When the document ended with a <br>, there were visual positions at both [br, 0] and [br, 1]. "
text run at (567,0) width 194: "This would produce inconsistent"
text run at (0,20) width 288: "behavior when editing at the end of a document."
LayoutBlockFlow {DIV} at (0,92) size 784x72 [border: (2px solid #AAAAFF)]
LayoutBlockFlow {DIV} at (2,2) size 780x24 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 87x19
text run at (2,2) width 87: "paragraph one"
LayoutBlockFlow {DIV} at (2,26) size 780x24 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 88x19
text run at (2,2) width 88: "paragraph two"
LayoutBlockFlow (anonymous) at (2,50) size 780x20
LayoutText {#text} at (0,0) size 7x19
text run at (0,0) width 7: "x"
caret: position 1 of child 5 {#text} of child 5 {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 784x20
LayoutText {#text} at (0,0) size 356x19
text run at (0,0) width 356: "This tests the visual position at the end of an editable block."
LayoutBlockFlow {P} at (0,36) size 784x40
LayoutText {#text} at (0,0) size 761x39
text run at (0,0) width 568: "When the document ended with a <br>, there were visual positions at both [br, 0] and [br, 1]. "
text run at (567,0) width 194: "This would produce inconsistent"
text run at (0,20) width 288: "behavior when editing at the end of a document."
LayoutBlockFlow {DIV} at (0,92) size 784x72 [border: (2px solid #AAAAFF)]
LayoutBlockFlow {DIV} at (2,2) size 780x24 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 87x19
text run at (2,2) width 87: "paragraph one"
LayoutBlockFlow {DIV} at (2,26) size 780x24 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 88x19
text run at (2,2) width 88: "paragraph two"
LayoutBlockFlow (anonymous) at (2,50) size 780x20
LayoutText {#text} at (0,0) size 7x19
text run at (0,0) width 7: "x"
caret: position 1 of child 5 {#text} of child 5 {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 784x18
LayoutText {#text} at (0,0) size 384x18
text run at (0,0) width 384: "This tests the visual position at the end of an editable block."
LayoutBlockFlow {P} at (0,34) size 784x36
LayoutText {#text} at (0,0) size 727x36
text run at (0,0) width 599: "When the document ended with a <br>, there were visual positions at both [br, 0] and [br, 1]. "
text run at (598,0) width 129: "This would produce"
text run at (0,18) width 390: "inconsistent behavior when editing at the end of a document."
LayoutBlockFlow {DIV} at (0,86) size 784x66 [border: (2px solid #AAAAFF)]
LayoutBlockFlow {DIV} at (2,2) size 780x22 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 92x18
text run at (2,2) width 92: "paragraph one"
LayoutBlockFlow {DIV} at (2,24) size 780x22 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 92x18
text run at (2,2) width 92: "paragraph two"
LayoutBlockFlow (anonymous) at (2,46) size 780x18
LayoutText {#text} at (0,0) size 8x18
text run at (0,0) width 8: "x"
caret: position 1 of child 5 {#text} of child 5 {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 784x18
LayoutText {#text} at (0,0) size 384x18
text run at (0,0) width 384: "This tests the visual position at the end of an editable block."
LayoutBlockFlow {P} at (0,34) size 784x36
LayoutText {#text} at (0,0) size 727x36
text run at (0,0) width 599: "When the document ended with a <br>, there were visual positions at both [br, 0] and [br, 1]. "
text run at (598,0) width 129: "This would produce"
text run at (0,18) width 390: "inconsistent behavior when editing at the end of a document."
LayoutBlockFlow {DIV} at (0,86) size 784x66 [border: (2px solid #AAAAFF)]
LayoutBlockFlow {DIV} at (2,2) size 780x22 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 92x18
text run at (2,2) width 92: "paragraph one"
LayoutBlockFlow {DIV} at (2,24) size 780x22 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 92x18
text run at (2,2) width 92: "paragraph two"
LayoutBlockFlow (anonymous) at (2,46) size 780x18
LayoutText {#text} at (0,0) size 8x18
text run at (0,0) width 8: "x"
caret: position 1 of child 5 {#text} of child 5 {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 784x18
LayoutText {#text} at (0,0) size 384x17
text run at (0,0) width 384: "This tests the visual position at the end of an editable block."
LayoutBlockFlow {P} at (0,34) size 784x36
LayoutText {#text} at (0,0) size 727x35
text run at (0,0) width 599: "When the document ended with a <br>, there were visual positions at both [br, 0] and [br, 1]. "
text run at (598,0) width 129: "This would produce"
text run at (0,18) width 390: "inconsistent behavior when editing at the end of a document."
LayoutBlockFlow {DIV} at (0,86) size 784x66 [border: (2px solid #AAAAFF)]
LayoutBlockFlow {DIV} at (2,2) size 780x22 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 92x17
text run at (2,2) width 92: "paragraph one"
LayoutBlockFlow {DIV} at (2,24) size 780x22 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 92x17
text run at (2,2) width 92: "paragraph two"
LayoutBlockFlow (anonymous) at (2,46) size 780x18
LayoutText {#text} at (0,0) size 8x17
text run at (0,0) width 8: "x"
caret: position 1 of child 5 {#text} of child 5 {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 784x18
LayoutText {#text} at (0,0) size 384x17
text run at (0,0) width 384: "This tests the visual position at the end of an editable block."
LayoutBlockFlow {P} at (0,34) size 784x36
LayoutText {#text} at (0,0) size 727x35
text run at (0,0) width 599: "When the document ended with a <br>, there were visual positions at both [br, 0] and [br, 1]. "
text run at (598,0) width 129: "This would produce"
text run at (0,18) width 390: "inconsistent behavior when editing at the end of a document."
LayoutBlockFlow {DIV} at (0,86) size 784x66 [border: (2px solid #AAAAFF)]
LayoutBlockFlow {DIV} at (2,2) size 780x22 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 92x17
text run at (2,2) width 92: "paragraph one"
LayoutBlockFlow {DIV} at (2,24) size 780x22 [border: (2px solid #FFAAAA)]
LayoutText {#text} at (2,2) size 92x17
text run at (2,2) width 92: "paragraph two"
LayoutBlockFlow (anonymous) at (2,46) size 780x18
LayoutText {#text} at (0,0) size 8x17
text run at (0,0) width 8: "x"
caret: position 1 of child 5 {#text} of child 5 {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