Commit 09fed68f authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() for "editing/inserting/4959067.html"

This patch changes "4959067.html" to utilize |selection_test()| for ease of
maintenance.

Following patch will rename "4959067.html" to "replace_contents_of_link.html"

Note: "4959067.html" is failed on layout_ng bot du by pixel test.

Bug: 679977, 636993
Change-Id: I700f0952a81d8aeed1e69cf0cdc9aa257fa5ee3f
Reviewed-on: https://chromium-review.googlesource.com/991972Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547889}
parent 16cd9523
<p>This tests to make sure that insertion over a fully selected special element doesn't do expansion.</p> <!doctype HTML>
<div contenteditable="true"> <script src="../../resources/testharness.js"></script>
<ul id="ul"><li><a id="anchor" href="http://www.google.com/">foo</a></li></ul> <script src="../../resources/testharnessreport.js"></script>
</div> <script src="../assert_selection.js"></script>
<ul id="console"></ul>
<script> <script>
function log(str) { // This tests to make sure that insertion over a fully selected special element
var li = document.createElement("li"); // doesn't do expansion.
var text = document.createTextNode(str); selection_test(
var console = document.getElementById("console"); [
li.appendChild(text); '<div contenteditable>',
console.appendChild(li); '<ul><li><a href="http://www.google.com/" id="anchor">^ab|</a></li></ul>',
} '</div>',
],
var sel = window.getSelection(); selection => {
var anchor = document.getElementById("anchor"); const anchor = selection.document.getElementById('anchor');
sel.setBaseAndExtent(anchor, 0, anchor, anchor.childNodes.length); selection.document.execCommand('insertText', false, 'CD');
document.execCommand("InsertText", false, "foo"); assert_equals(anchor, selection.document.getElementById('anchor'),
anchor = document.getElementById("anchor"); 'We should keep an A element');
if (!anchor) },
log("Failure: a special element was removed during insertion."); [
'<div contenteditable>',
'<ul><li><a href="http://www.google.com/" id="anchor">CD|</a></li></ul>',
'</div>',
],
'insertText to replace contents of A');
</script> </script>
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 784x576
LayoutBlockFlow {P} at (0,0) size 784x20
LayoutText {#text} at (0,0) size 598x19
text run at (0,0) width 598: "This tests to make sure that insertion over a fully selected special element doesn't do expansion."
LayoutBlockFlow {DIV} at (0,36) size 784x20
LayoutBlockFlow {UL} at (0,0) size 784x20
LayoutListItem {LI} at (40,0) size 744x20
LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet
LayoutInline {A} at (0,0) size 21x19 [color=#0000EE]
LayoutText {#text} at (0,0) size 21x19
text run at (0,0) width 21: "foo"
LayoutBlockFlow {UL} at (0,72) size 784x0
caret: position 3 of child 0 {#text} of child 0 {A} of child 0 {LI} of child 1 {UL} of child 2 {DIV} of body
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 784x576
LayoutBlockFlow {P} at (0,0) size 784x18
LayoutText {#text} at (0,0) size 613x18
text run at (0,0) width 613: "This tests to make sure that insertion over a fully selected special element doesn't do expansion."
LayoutBlockFlow {DIV} at (0,34) size 784x18
LayoutBlockFlow {UL} at (0,0) size 784x18
LayoutListItem {LI} at (40,0) size 744x18
LayoutListMarker (anonymous) at (-17,0) size 7x18: bullet
LayoutInline {A} at (0,0) size 22x18 [color=#0000EE]
LayoutText {#text} at (0,0) size 22x18
text run at (0,0) width 22: "foo"
LayoutBlockFlow {UL} at (0,68) size 784x0
caret: position 3 of child 0 {#text} of child 0 {A} of child 0 {LI} of child 1 {UL} of child 2 {DIV} of body
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 784x576
LayoutBlockFlow {P} at (0,0) size 784x20
LayoutText {#text} at (0,0) size 571x19
text run at (0,0) width 571: "This tests to make sure that insertion over a fully selected special element doesn't do expansion."
LayoutBlockFlow {DIV} at (0,36) size 784x20
LayoutBlockFlow {UL} at (0,0) size 784x20
LayoutListItem {LI} at (40,0) size 744x20
LayoutListMarker (anonymous) at (-18,0) size 7x19: bullet
LayoutInline {A} at (0,0) size 20x19 [color=#0000EE]
LayoutText {#text} at (0,0) size 20x19
text run at (0,0) width 20: "foo"
LayoutBlockFlow {UL} at (0,72) size 784x0
caret: position 3 of child 0 {#text} of child 0 {A} of child 0 {LI} of child 1 {UL} 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