accessible/tests/mochitest/states/test_textbox.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     4                  type="text/css"?>
     6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     7         title="nsIAccessible XUL textboxes states tests">
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    12   <script type="application/javascript"
    13           src="../common.js" />
    14   <script type="application/javascript"
    15           src="../role.js" />
    16   <script type="application/javascript"
    17           src="../states.js" />
    19   <script type="application/javascript">
    20   <![CDATA[
    21     function getInput(aID)
    22     {
    23       return getNode(aID).inputField;
    24     }
    26     function doTest()
    27     {
    28       //////////////////////////////////////////////////////////////////////////
    29       // Ordinary textbox
    30       testStates(getInput("textbox"),
    31                  STATE_FOCUSABLE,
    32                  EXT_STATE_EDITABLE,
    33                  STATE_PROTECTED | STATE_UNAVAILABLE,
    34                  EXT_STATE_SUPPORTS_AUTOCOMPLETION,
    35                  "ordinary textbox");
    37       //////////////////////////////////////////////////////////////////////////
    38       // Password textbox
    39       testStates(getInput("password"),
    40                  STATE_FOCUSABLE | STATE_PROTECTED,
    41                  EXT_STATE_EDITABLE,
    42                  STATE_UNAVAILABLE,
    43                  EXT_STATE_SUPPORTS_AUTOCOMPLETION,
    44                  "password textbox");
    46       //////////////////////////////////////////////////////////////////////////
    47       // Textarea
    48       testStates(getInput("textarea"),
    49                  STATE_FOCUSABLE,
    50                  EXT_STATE_EDITABLE | EXT_STATE_MULTI_LINE,
    51                  STATE_PROTECTED | STATE_UNAVAILABLE,
    52                  EXT_STATE_SUPPORTS_AUTOCOMPLETION,
    53                  "multiline textbox");
    55       //////////////////////////////////////////////////////////////////////////
    56       // Readonly textbox
    57       testStates(getInput("readonly_textbox"),
    58                  STATE_FOCUSABLE | STATE_READONLY,
    59                  EXT_STATE_EDITABLE,
    60                  STATE_PROTECTED | STATE_UNAVAILABLE,
    61                  EXT_STATE_SUPPORTS_AUTOCOMPLETION,
    62                  "readonly textbox");
    64       //////////////////////////////////////////////////////////////////////////
    65       // Disabled textbox
    66       testStates(getInput("disabled_textbox"),
    67                  STATE_UNAVAILABLE,
    68                  EXT_STATE_EDITABLE,
    69                  STATE_FOCUSABLE | STATE_PROTECTED,
    70                  EXT_STATE_SUPPORTS_AUTOCOMPLETION,
    71                  "readonly textbox");
    73       //////////////////////////////////////////////////////////////////////////
    74       // Readonly textarea
    75       testStates(getInput("readonly_textarea"),
    76                  STATE_FOCUSABLE | STATE_READONLY,
    77                  EXT_STATE_EDITABLE | EXT_STATE_MULTI_LINE,
    78                  STATE_PROTECTED | STATE_UNAVAILABLE,
    79                  EXT_STATE_SUPPORTS_AUTOCOMPLETION,
    80                  "readonly multiline textbox");
    82       //////////////////////////////////////////////////////////////////////////
    83       // Disabled textarea
    84       testStates(getInput("disabled_textarea"),
    85                  STATE_UNAVAILABLE,
    86                  EXT_STATE_EDITABLE| EXT_STATE_MULTI_LINE,
    87                  STATE_PROTECTED | STATE_FOCUSABLE,
    88                  EXT_STATE_SUPPORTS_AUTOCOMPLETION,
    89                  "readonly multiline textbox");
    91       //////////////////////////////////////////////////////////////////////////
    92       // Search textbox without search button, searches as you type and filters
    93       // a separate control.
    94       testStates(getInput("searchbox"),
    95                  STATE_FOCUSABLE,
    96                  EXT_STATE_EDITABLE | EXT_STATE_SUPPORTS_AUTOCOMPLETION,
    97                  STATE_PROTECTED | STATE_UNAVAILABLE,
    98                  0,
    99                  "searchbox");
   101       //////////////////////////////////////////////////////////////////////////
   102       // Search textbox with search button, does not support autoCompletion.
   103       testStates(getInput("searchfield"),
   104                  STATE_FOCUSABLE,
   105                  EXT_STATE_EDITABLE,
   106                  STATE_PROTECTED | STATE_UNAVAILABLE,
   107                  EXT_STATE_SUPPORTS_AUTOCOMPLETION,
   108                  "searchfield");
   110       SimpleTest.finish();
   111     }
   113     SimpleTest.waitForExplicitFinish();
   114     addA11yLoadEvent(doTest);
   115   ]]>
   116   </script>
   118   <hbox flex="1" style="overflow: auto;">
   120   <body xmlns="http://www.w3.org/1999/xhtml">
   121     <a target="_blank"
   122        href="https://bugzilla.mozilla.org/show_bug.cgi?id=442648">
   123       Mozilla Bug 442648
   124     </a>
   125     <a target="_blank"
   126        href="https://bugzilla.mozilla.org/show_bug.cgi?id=648235"
   127        title="XUL textbox can inherit more states from underlying HTML input">
   128       Mozilla Bug 648235
   129     </a>
   130     <p id="display"></p>
   131     <div id="content" style="display: none"></div>
   132     <pre id="test">
   133     </pre>
   134   </body>
   136   <vbox flex="1">
   137     <textbox id="textbox"/>
   138     <textbox id="password" type="password"/>
   139     <textbox id="textarea" multiline="true" cols="80" rows="5"/>
   141     <textbox id="readonly_textbox" readonly="true"/>
   142     <textbox id="disabled_textbox" disabled="true"/>
   143     <textbox id="readonly_textarea" multiline="true" readonly="true"
   144              cols="80" rows="5"/>
   145     <textbox id="disabled_textarea" multiline="true" disabled="true"
   146              cols="80" rows="5"/>
   148     <textbox id="searchbox" flex="1" type="search" results="historyTree"/>
   149     <textbox id="searchfield" placeholder="Search all add-ons"
   150              type="search" searchbutton="true"/>
   151   </vbox>
   152   </hbox>
   153 </window>

mercurial