interestfor-user-select.tentative.html (1403B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <link rel="author" href="mailto:masonf@chromium.org"> 4 <link rel="help" href="https://drafts.csswg.org/css-ui/#propdef-user-select"> 5 <link rel="help" href="https://open-ui.org/components/interest-invokers.explainer"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-actions.js"></script> 10 <script src='/resources/testdriver-vendor.js'></script> 11 12 <button interestfor=foo>ABCDEFGHI<span id=inside>JKLMNOPQ</span>RSTUVWXYZ</button> 13 <div>Something after the button</div> 14 <div id=after>Something else</div> 15 16 <script> 17 promise_test(async function() { 18 assert_equals(window.getSelection().toString(), "", "Nothing should start out selected"); 19 20 await new test_driver.Actions() 21 .pointerMove(1, 1, {origin: after}) 22 .pointerDown({ button: 0 }) 23 .pointerMove(1, 1, {origin: inside}) 24 .pointerUp({ button: 0 }) 25 .send(); 26 const selection = window.getSelection().toString(); 27 assert_not_equals(selection, "", "Something should be selected"); 28 assert_true(selection.includes("Something after"),'The selection should include the outside text'); 29 assert_false(selection.includes("RSTUVWXYZ"),'The selection should not include the button text'); 30 }, "Buttons with `interestfor` should not be user-selectable"); 31 </script>