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>
<div contenteditable="true">
<ul id="ul"><li><a id="anchor" href="http://www.google.com/">foo</a></li></ul>
</div>
<ul id="console"></ul>
<!doctype HTML>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
function log(str) {
var li = document.createElement("li");
var text = document.createTextNode(str);
var console = document.getElementById("console");
li.appendChild(text);
console.appendChild(li);
}
var sel = window.getSelection();
var anchor = document.getElementById("anchor");
sel.setBaseAndExtent(anchor, 0, anchor, anchor.childNodes.length);
document.execCommand("InsertText", false, "foo");
anchor = document.getElementById("anchor");
if (!anchor)
log("Failure: a special element was removed during insertion.");
// This tests to make sure that insertion over a fully selected special element
// doesn't do expansion.
selection_test(
[
'<div contenteditable>',
'<ul><li><a href="http://www.google.com/" id="anchor">^ab|</a></li></ul>',
'</div>',
],
selection => {
const anchor = selection.document.getElementById('anchor');
selection.document.execCommand('insertText', false, 'CD');
assert_equals(anchor, selection.document.getElementById('anchor'),
'We should keep an A element');
},
[
'<div contenteditable>',
'<ul><li><a href="http://www.google.com/" id="anchor">CD|</a></li></ul>',
'</div>',
],
'insertText to replace contents of A');
</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