summaryrefslogtreecommitdiff
path: root/accessible/tests/mochitest/states/test_buttons.html
blob: 52c642ce5ea94445067805bc6fc6c87918d849a4 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<head>
  <title>HTML button accessible states</title>
  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../role.js"></script>
  <script type="application/javascript"
          src="../states.js"></script>

  <script type="application/javascript">
  function doTest()
  {
    // Default state.
    testStates("f1_image", STATE_DEFAULT | STATE_FOCUSABLE);
    testStates("f2_submit", STATE_DEFAULT | STATE_FOCUSABLE);
    testStates("f3_submitbutton", STATE_DEFAULT | STATE_FOCUSABLE);
    testStates("f3_disabled_reset", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE, 0);
    testStates("f4_button", STATE_FOCUSABLE, 0, STATE_DEFAULT);
    testStates("f4_disabled_button", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE, 0);
    testStates("f4_image1", STATE_DEFAULT | STATE_FOCUSABLE);
    testStates("f4_image2", STATE_FOCUSABLE, 0, STATE_DEFAULT);
    testStates("f4_submit", STATE_FOCUSABLE, 0, STATE_DEFAULT);
    testStates("f4_submitbutton", STATE_FOCUSABLE, 0, STATE_DEFAULT);

    SimpleTest.finish();
  }

  SimpleTest.waitForExplicitFinish();
  addA11yLoadEvent(doTest);
  </script>
</head>

<body>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=664142"
     title="DEFAULT state exposed incorrectly for HTML">
    Mozilla Bug 664142
  </a>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <p>A form with an image button</p>
  <form name="form1" method="get">
    <input type="text" name="hi">

    <input id="f1_image" type="image" value="image-button">
  </form>

  <p>A form with a submit button:</p>
  <form name="form2" method="get">
    <input type="text" name="hi">
    <input id="f2_submit" type="submit">
  </form>

  <p>A form with a HTML4 submit button:</p>
  <form name="form3" method="get">
    <input type="text" name="hi">
    <button id="f3_submitbutton" type="submit">submit</button>
    <button id="f3_disabled_reset" type="reset" disabled>reset</button>
  </form>

  <p>A form with normal button, two image buttons, submit button,
    HTML4 submit button:</p>
  <form name="form4" method="get">
    <input type="text" name="hi">
    <input id="f4_button" type="button" value="normal" name="normal-button">
    <input id="f4_disabled_button" type="button" value="disabled" name="disabled-button" disabled>
    <input id="f4_image1" type="image" value="image-button1" name="image-button1">
    <input id="f4_image2" type="image" value="image-button2" name="image-button2">
    <input id="f4_submit" type="submit" value="real-submit" name="real-submit">
    <button id="f4_submitbutton" type="submit">submit</button>
  </form>

  </body>
</html>