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.

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

mercurial