Index: third_party/WebKit/LayoutTests/editing/deleting/backspace-merge-into-block.html |
diff --git a/third_party/WebKit/LayoutTests/editing/deleting/backspace-merge-into-block.html b/third_party/WebKit/LayoutTests/editing/deleting/backspace-merge-into-block.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a60609b267a2ec48ecbbc656e9c9664c4c394ff3 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/deleting/backspace-merge-into-block.html |
@@ -0,0 +1,88 @@ |
+<!doctype HTML> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<style> |
+p { |
+ font-size: 20px; |
+ line-height: 22px; |
+ color: red; |
+} |
+</style> |
+<div contenteditable="true" id="editable_h1"> |
+ <h1>Heading 1:</h1> |
+ <p>paragraph was merged.</p> |
+</div> |
+<div contenteditable="true" id="editable_pre"> |
+ <pre>Preformatted text:</pre> |
+ <p>paragraph was merged.</p> |
+</div> |
+<div contenteditable="true" id="editable_li"> |
+ <ul> |
+ <li>List Item:</li> |
+ </ul> |
+ <p>paragraph was merged.</p> |
+</div> |
+<div contenteditable="true" id="editable_table"> |
+ <table><tbody><tr><td>Table:</td></tr></tbody></table> |
+ <p>paragraph was merged.</p> |
+<script> |
+test(function() { |
+ var editor = document.getElementById('editable_h1'); |
+ var range = document.createRange(); |
+ var selection = window.getSelection(); |
+ range.setStart(editor.childNodes[2], 0); |
yosin_UTC9
2016/06/28 01:27:50
Better to use "id" attribute to be more specific.
|
+ range.collapse(true); |
+ selection.removeAllRanges(); |
+ selection.addRange(range); |
yosin_UTC9
2016/06/28 01:27:50
|selection.collapse(editor.childNodes[2], 0)| is s
|
+ editor.focus(); |
+ document.execCommand('delete'); |
+ |
+ var html = document.getElementsByTagName('h1')[0].outerHTML; |
+ assert_equals(html, '<h1>Heading 1:paragraph was merged.</h1>'); |
yosin_UTC9
2016/06/28 01:27:50
Can we use |assert_selection()|?
See http://crrev.
joone
2016/06/28 08:41:43
Done.
|
+}, 'make a paragraph into a heading by backspace'); |
+ |
+test(function() { |
+ var editor = document.getElementById('editable_pre'); |
+ var range = document.createRange(); |
+ var selection = window.getSelection(); |
+ range.setStart(editor.childNodes[2], 0); |
+ range.collapse(true); |
+ selection.removeAllRanges(); |
+ selection.addRange(range); |
+ editor.focus(); |
+ document.execCommand('delete'); |
+ |
+ var html = document.getElementsByTagName('pre')[0].outerHTML; |
+ assert_equals(html, '<pre>Preformatted text:paragraph was merged.</pre>'); |
+}, 'make a paragraph into a pre by backspace'); |
+ |
+test(function() { |
+ var editor = document.getElementById('editable_li'); |
+ var range = document.createRange(); |
+ var selection = window.getSelection(); |
+ range.setStart(editor.childNodes[2], 0); |
+ range.collapse(true); |
+ selection.removeAllRanges(); |
+ selection.addRange(range); |
+ editor.focus(); |
+ document.execCommand('delete'); |
+ |
+ var html = document.getElementsByTagName('li')[0].outerHTML; |
+ assert_equals(html, '<li>List Item:paragraph was merged.</li>'); |
+}, 'make a paragraph into a list by backspace'); |
+ |
+test(function() { |
+ var editor = document.getElementById('editable_table'); |
+ var range = document.createRange(); |
+ var selection = window.getSelection(); |
+ range.setStart(editor.childNodes[2], 0); |
+ range.collapse(true); |
+ selection.removeAllRanges(); |
+ selection.addRange(range); |
+ editor.focus(); |
+ document.execCommand('delete'); |
+ |
+ var html = document.getElementsByTagName('table')[0].outerHTML; |
+ assert_equals(html, '<table><tbody><tr><td>Table:paragraph was merged.</td></tr></tbody></table>'); |
+}, 'make a paragraph into a table by backspace'); |
+</script> |