summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/selectors/pseudo-classes/active-disabled.html
blob: a75a157c58f57814f421bd19aa588eaf75270f73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://github.com/whatwg/html/pull/7465">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<label id=buttonlabel for=disabledbutton>label for disabled button</label>
<button id=disabledbutton disabled>disabled</button>

<button id=buttonparent disabled>
  <div id=buttonchild>child of disabled</div>
</button>

<input id=disabledinput disabled>

<textarea id=disabledtextarea disabled>disabled textarea</textarea>

<script>
function testElement(description, clickElement, checkElement) {
  promise_test(async () => {
    if (!checkElement)
      checkElement = clickElement;

    await (new test_driver.Actions()
      .pointerMove(2, 2, {origin: clickElement})
      .pointerDown())
      .send();

    assert_true(checkElement.matches(':active'));

    await (new test_driver.Actions()
      .pointerUp())
      .send();
  }, description);
}

testElement('Clicking on a disabled button should make it match the :active selector.',
    disabledbutton);

testElement('Clicking the label for a disabled button should make the button match the :active selector.',
    buttonlabel, disabledbutton);

testElement('Clicking on a child of a disabled button should make the button match the :active selector.',
    buttonchild, buttonparent);

testElement('Clicking on a disabled input should make it match the :active selector.',
    disabledinput);

testElement('Clicking on a disabled textarea should make it match the :active selector.',
    disabledtextarea);
</script>