text-selection-with-delegatesFocus-on-slotted-content.html (1250B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testdriver.js"></script> 5 <script src="/resources/testdriver-actions.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 <link rel="help" href="https://issues.chromium.org/issues/40622041"> 8 9 <body> 10 <p>Try to select the text in the dialog...</p> 11 <div id="host"> 12 <span id="slotted">Slotted content</span> 13 </div> 14 </body> 15 16 <script> 17 'use strict'; 18 19 promise_test(async () => { 20 host.attachShadow({mode: 'open', delegatesFocus: true}); 21 host.shadowRoot.innerHTML = ` 22 <dialog> 23 <slot></slot> 24 <div>Content</div> 25 </dialog>`; 26 host.shadowRoot.firstElementChild.show(); 27 28 const selection = getSelection(); 29 selection.empty(); 30 31 const slotted = document.getElementById('slotted'); 32 33 // Mouse down and drag to select text 34 const actions = new test_driver.Actions(); 35 actions.pointerMove(0, 0, {origin: slotted}); 36 actions.pointerDown(); 37 actions.pointerMove(30, 0, {origin: slotted}); 38 actions.pointerUp(); 39 await actions.send(); 40 41 assert_greater_than(selection.toString().length, 0); 42 }, 'select slotted text in shadow root with delegatesFocus.'); 43 44 </script>