execcommand-insertList-in-shadow.html (1544B)
1 <!DOCTYPE html> 2 <html> 3 <title> 4 In this test, we do execCommand('InsertUnorderedList') on the 5 unordered list inside the ShadowRoot to confirm that list toggle off 6 for all the child nodes. 7 </title> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="/resources/testharness.js"></script> 12 <script src="/resources/testharnessreport.js"></script> 13 <body> 14 <div id="container" contenteditable></div> 15 <script> 16 promise_test(async () => { 17 const shadowRoot = container.attachShadow({ mode: "open" }); 18 shadowRoot.innerHTML = 19 `<div id="list" contenteditable="true">` + 20 `<ul><li>Bullet One</li>` + 21 `<li>Bullet Two</li>` + 22 `<li>Bullet Three</li></ul>` + 23 `</div>`; 24 const shadowItem = shadowRoot.querySelector("div"); 25 await new test_driver.Actions() 26 .pointerMove(shadowItem.offsetLeft, shadowItem.offsetTop) 27 .pointerDown() 28 .pointerMove( 29 shadowItem.offsetLeft + shadowItem.offsetWidth, 30 shadowItem.offsetTop + shadowItem.offsetHeight 31 ) 32 .pointerUp() 33 .send(); 34 document.execCommand("InsertUnorderedList"); 35 assert_equals( 36 shadowItem.innerHTML, 37 "Bullet One<br>Bullet Two<br>Bullet Three" 38 ); 39 }, "Toggle off List for all the child nodes in the ShadowRoot"); 40 </script> 41 </body> 42 </html>