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