Commit 88f5558d authored by Shimi Zhang's avatar Shimi Zhang Committed by Commit Bot

Convert editing/deleting/6026335.html to utilize |selection_test()|

In preparing for http://crrev/c/1102157, make it easier for us to handle
the behavior change.

Bug: 847192
Change-Id: I0f67b894e38737339efa2aafe3093324876f5368
Reviewed-on: https://chromium-review.googlesource.com/1106598
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568690}
parent 20579735
This tests deleting a selection that starts at the beginning of an editable pocket inside a non-editable table. The caret should not disappear during the delete and should be placed inside the editable span. When text is then inserted, it should be placed inside that span.
<div contenteditable="false"><span>&nbsp;</span><span contenteditable="true" id="start">Text</span></div>
<div id="description">This tests deleting a selection that starts at the beginning of an editable pocket inside a non-editable table. The caret should not disappear during the delete and should be placed inside the editable span. When text is then inserted, it should be placed inside that span.</div> <!DOCTYPE html>
<div id="edit" contentEditable="true"> <script src="../../resources/testharness.js"></script>
<div contentEditable="false"><span>&nbsp;</span><span contentEditable="true" id="start">Hello</span></div> <script src="../../resources/testharnessreport.js"></script>
<div id="end"><br></div> <script src="../assert_selection.js"></script>
</div>
<script> <script>
if (window.testRunner) selection_test(
testRunner.dumpAsText(); [ '<div contenteditable>',
start = document.getElementById("start"); '<div contenteditable="false">',
end = document.getElementById("end"); '<span>&nbsp;</span>',
s = window.getSelection(); '<span contenteditable>|Hello</span>',
s.setBaseAndExtent(start, 0, end, 0); '</div>',
document.execCommand("Delete"); '<div>^<br></div>',
document.execCommand("InsertText", false, "Text"); '</div>',
if (window.testRunner) ],
document.body.innerText = document.getElementById("description").innerText + "\n" + document.getElementById("edit").innerHTML; 'delete',
[ '<div contenteditable>',
'<div contenteditable="false">',
'<span>\xa0</span>',
'<span contenteditable>|</span>',
'</div>',
'</div>',
],
'Test stage 1, tests deleting a selection that starts at the beginning of an editable pocket'
+ ' inside a non-editable table. The caret should not disappear during the delete and should be'
+ ' placed inside the editable span.'
);
selection_test(
[ '<div contenteditable>',
'<div contenteditable="false">',
'<span>\xa0</span>',
'<span contenteditable>|</span>',
'</div>',
'</div>',
],
'insertText Text',
[ '<div contenteditable>',
'<div contenteditable="false">',
'<span>\xa0</span>',
'<span contenteditable>Text|</span>',
'</div>',
'</div>',
],
'Test stage 2, when text is then inserted, it should be placed inside that span.'
);
</script> </script>
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