accessible/tests/mochitest/states/test_buttons.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4   <title>HTML button accessible states</title>
     5   <link rel="stylesheet" type="text/css"
     6         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     8   <script type="application/javascript"
     9           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    11   <script type="application/javascript"
    12           src="../common.js"></script>
    13   <script type="application/javascript"
    14           src="../role.js"></script>
    15   <script type="application/javascript"
    16           src="../states.js"></script>
    18   <script type="application/javascript">
    19   function doTest()
    20   {
    21     // Default state.
    22     testStates("f1_image", STATE_DEFAULT | STATE_FOCUSABLE);
    23     testStates("f2_submit", STATE_DEFAULT | STATE_FOCUSABLE);
    24     testStates("f3_submitbutton", STATE_DEFAULT | STATE_FOCUSABLE);
    25     testStates("f3_disabled_reset", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE, 0);
    26     testStates("f4_button", STATE_FOCUSABLE, 0, STATE_DEFAULT);
    27     testStates("f4_disabled_button", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE, 0);
    28     testStates("f4_image1", STATE_DEFAULT | STATE_FOCUSABLE);
    29     testStates("f4_image2", STATE_FOCUSABLE, 0, STATE_DEFAULT);
    30     testStates("f4_submit", STATE_FOCUSABLE, 0, STATE_DEFAULT);
    31     testStates("f4_submitbutton", STATE_FOCUSABLE, 0, STATE_DEFAULT);
    33     SimpleTest.finish();
    34   }
    36   SimpleTest.waitForExplicitFinish();
    37   addA11yLoadEvent(doTest);
    38   </script>
    39 </head>
    41 <body>
    42   <a target="_blank"
    43      href="https://bugzilla.mozilla.org/show_bug.cgi?id=664142"
    44      title="DEFAULT state exposed incorrectly for HTML">
    45     Mozilla Bug 664142
    46   </a>
    47   <p id="display"></p>
    48   <div id="content" style="display: none"></div>
    49   <pre id="test">
    50   </pre>
    52   <p>A form with an image button</p>
    53   <form name="form1" method="get">
    54     <input type="text" name="hi">
    56     <input id="f1_image" type="image" value="image-button">
    57   </form>
    59   <p>A form with a submit button:</p>
    60   <form name="form2" method="get">
    61     <input type="text" name="hi">
    62     <input id="f2_submit" type="submit">
    63   </form>
    65   <p>A form with a HTML4 submit button:</p>
    66   <form name="form3" method="get">
    67     <input type="text" name="hi">
    68     <button id="f3_submitbutton" type="submit">submit</button>
    69     <button id="f3_disabled_reset" type="reset" disabled>reset</button>
    70   </form>
    72   <p>A form with normal button, two image buttons, submit button,
    73     HTML4 submit button:</p>
    74   <form name="form4" method="get">
    75     <input type="text" name="hi">
    76     <input id="f4_button" type="button" value="normal" name="normal-button">
    77     <input id="f4_disabled_button" type="button" value="disabled" name="disabled-button" disabled>
    78     <input id="f4_image1" type="image" value="image-button1" name="image-button1">
    79     <input id="f4_image2" type="image" value="image-button2" name="image-button2">
    80     <input id="f4_submit" type="submit" value="real-submit" name="real-submit">
    81     <button id="f4_submitbutton" type="submit">submit</button>
    82   </form>
    84   </body>
    85 </html>

mercurial