delete-at-start-boundary-of-div-containing-hidden-select-element-with-non-editable-node.html (1539B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Delete at start boundary of div containing hidden select element 6 with non editable node</title> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-vendor.js"></script> 11 <script src="/resources/testdriver-actions.js"></script> 12 </head> 13 <body> 14 <div contenteditable="true" id="editableDiv"><div id="first">First block</div> 15 <div id="second">Second block<select style="visibility:hidden"></select></div></div> 16 <script> 17 "use strict"; 18 19 const kBackspaceKey = "\uE003"; 20 21 function sendBackspaceKey() { 22 return new test_driver.Actions() 23 .keyDown(kBackspaceKey) 24 .keyUp(kBackspaceKey) 25 .send(); 26 } 27 28 promise_test(async () => { 29 const secondDiv = document.getElementById("second"); 30 await new test_driver.click(document.querySelector('#second')); 31 const range = document.createRange(); 32 const selection = window.getSelection(); 33 range.setStart(secondDiv.firstChild, 0); 34 range.collapse(true); 35 selection.removeAllRanges(); 36 selection.addRange(range); 37 await sendBackspaceKey(); 38 const expected = "<div id=\"first\">First blockSecond block</div>" 39 + "<div id=\"second\"><select style=\"visibility:hidden\"></select></div>"; 40 assert_equals( 41 editableDiv.innerHTML, 42 expected, 43 "The test should not crash and Second block should be merged with First block" 44 ); 45 }, "waiting for command to execute"); 46 </script> 47 </body> 48 </html>