1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/states/test_textbox.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,153 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 + 1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.10 + title="nsIAccessible XUL textboxes states tests"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + 1.15 + <script type="application/javascript" 1.16 + src="../common.js" /> 1.17 + <script type="application/javascript" 1.18 + src="../role.js" /> 1.19 + <script type="application/javascript" 1.20 + src="../states.js" /> 1.21 + 1.22 + <script type="application/javascript"> 1.23 + <![CDATA[ 1.24 + function getInput(aID) 1.25 + { 1.26 + return getNode(aID).inputField; 1.27 + } 1.28 + 1.29 + function doTest() 1.30 + { 1.31 + ////////////////////////////////////////////////////////////////////////// 1.32 + // Ordinary textbox 1.33 + testStates(getInput("textbox"), 1.34 + STATE_FOCUSABLE, 1.35 + EXT_STATE_EDITABLE, 1.36 + STATE_PROTECTED | STATE_UNAVAILABLE, 1.37 + EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.38 + "ordinary textbox"); 1.39 + 1.40 + ////////////////////////////////////////////////////////////////////////// 1.41 + // Password textbox 1.42 + testStates(getInput("password"), 1.43 + STATE_FOCUSABLE | STATE_PROTECTED, 1.44 + EXT_STATE_EDITABLE, 1.45 + STATE_UNAVAILABLE, 1.46 + EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.47 + "password textbox"); 1.48 + 1.49 + ////////////////////////////////////////////////////////////////////////// 1.50 + // Textarea 1.51 + testStates(getInput("textarea"), 1.52 + STATE_FOCUSABLE, 1.53 + EXT_STATE_EDITABLE | EXT_STATE_MULTI_LINE, 1.54 + STATE_PROTECTED | STATE_UNAVAILABLE, 1.55 + EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.56 + "multiline textbox"); 1.57 + 1.58 + ////////////////////////////////////////////////////////////////////////// 1.59 + // Readonly textbox 1.60 + testStates(getInput("readonly_textbox"), 1.61 + STATE_FOCUSABLE | STATE_READONLY, 1.62 + EXT_STATE_EDITABLE, 1.63 + STATE_PROTECTED | STATE_UNAVAILABLE, 1.64 + EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.65 + "readonly textbox"); 1.66 + 1.67 + ////////////////////////////////////////////////////////////////////////// 1.68 + // Disabled textbox 1.69 + testStates(getInput("disabled_textbox"), 1.70 + STATE_UNAVAILABLE, 1.71 + EXT_STATE_EDITABLE, 1.72 + STATE_FOCUSABLE | STATE_PROTECTED, 1.73 + EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.74 + "readonly textbox"); 1.75 + 1.76 + ////////////////////////////////////////////////////////////////////////// 1.77 + // Readonly textarea 1.78 + testStates(getInput("readonly_textarea"), 1.79 + STATE_FOCUSABLE | STATE_READONLY, 1.80 + EXT_STATE_EDITABLE | EXT_STATE_MULTI_LINE, 1.81 + STATE_PROTECTED | STATE_UNAVAILABLE, 1.82 + EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.83 + "readonly multiline textbox"); 1.84 + 1.85 + ////////////////////////////////////////////////////////////////////////// 1.86 + // Disabled textarea 1.87 + testStates(getInput("disabled_textarea"), 1.88 + STATE_UNAVAILABLE, 1.89 + EXT_STATE_EDITABLE| EXT_STATE_MULTI_LINE, 1.90 + STATE_PROTECTED | STATE_FOCUSABLE, 1.91 + EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.92 + "readonly multiline textbox"); 1.93 + 1.94 + ////////////////////////////////////////////////////////////////////////// 1.95 + // Search textbox without search button, searches as you type and filters 1.96 + // a separate control. 1.97 + testStates(getInput("searchbox"), 1.98 + STATE_FOCUSABLE, 1.99 + EXT_STATE_EDITABLE | EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.100 + STATE_PROTECTED | STATE_UNAVAILABLE, 1.101 + 0, 1.102 + "searchbox"); 1.103 + 1.104 + ////////////////////////////////////////////////////////////////////////// 1.105 + // Search textbox with search button, does not support autoCompletion. 1.106 + testStates(getInput("searchfield"), 1.107 + STATE_FOCUSABLE, 1.108 + EXT_STATE_EDITABLE, 1.109 + STATE_PROTECTED | STATE_UNAVAILABLE, 1.110 + EXT_STATE_SUPPORTS_AUTOCOMPLETION, 1.111 + "searchfield"); 1.112 + 1.113 + SimpleTest.finish(); 1.114 + } 1.115 + 1.116 + SimpleTest.waitForExplicitFinish(); 1.117 + addA11yLoadEvent(doTest); 1.118 + ]]> 1.119 + </script> 1.120 + 1.121 + <hbox flex="1" style="overflow: auto;"> 1.122 + 1.123 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.124 + <a target="_blank" 1.125 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=442648"> 1.126 + Mozilla Bug 442648 1.127 + </a> 1.128 + <a target="_blank" 1.129 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=648235" 1.130 + title="XUL textbox can inherit more states from underlying HTML input"> 1.131 + Mozilla Bug 648235 1.132 + </a> 1.133 + <p id="display"></p> 1.134 + <div id="content" style="display: none"></div> 1.135 + <pre id="test"> 1.136 + </pre> 1.137 + </body> 1.138 + 1.139 + <vbox flex="1"> 1.140 + <textbox id="textbox"/> 1.141 + <textbox id="password" type="password"/> 1.142 + <textbox id="textarea" multiline="true" cols="80" rows="5"/> 1.143 + 1.144 + <textbox id="readonly_textbox" readonly="true"/> 1.145 + <textbox id="disabled_textbox" disabled="true"/> 1.146 + <textbox id="readonly_textarea" multiline="true" readonly="true" 1.147 + cols="80" rows="5"/> 1.148 + <textbox id="disabled_textarea" multiline="true" disabled="true" 1.149 + cols="80" rows="5"/> 1.150 + 1.151 + <textbox id="searchbox" flex="1" type="search" results="historyTree"/> 1.152 + <textbox id="searchfield" placeholder="Search all add-ons" 1.153 + type="search" searchbutton="true"/> 1.154 + </vbox> 1.155 + </hbox> 1.156 +</window>