active-disabled.html (1778B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=help href="https://github.com/whatwg/html/pull/7465"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testdriver.js"></script> 7 <script src="/resources/testdriver-actions.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 10 <label id=buttonlabel for=disabledbutton>label for disabled button</label> 11 <button id=disabledbutton disabled>disabled</button> 12 13 <button id=buttonparent disabled> 14 <div id=buttonchild>child of disabled</div> 15 </button> 16 17 <input id=disabledinput disabled> 18 19 <textarea id=disabledtextarea disabled>disabled textarea</textarea> 20 21 <script> 22 function testElement(description, clickElement, checkElement) { 23 promise_test(async () => { 24 if (!checkElement) 25 checkElement = clickElement; 26 27 await (new test_driver.Actions() 28 .pointerMove(2, 2, {origin: clickElement}) 29 .pointerDown()) 30 .send(); 31 32 assert_true(checkElement.matches(':active')); 33 34 await (new test_driver.Actions() 35 .pointerUp()) 36 .send(); 37 }, description); 38 } 39 40 testElement('Clicking on a disabled button should make it match the :active selector.', 41 disabledbutton); 42 43 testElement('Clicking the label for a disabled button should make the button match the :active selector.', 44 buttonlabel, disabledbutton); 45 46 testElement('Clicking on a child of a disabled button should make the button match the :active selector.', 47 buttonchild, buttonparent); 48 49 testElement('Clicking on a disabled input should make it match the :active selector.', 50 disabledinput); 51 52 testElement('Clicking on a disabled textarea should make it match the :active selector.', 53 disabledtextarea); 54 </script>