accessible/tests/mochitest/states/test_selects.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/states/test_selects.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,203 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>HTML selects accessible states tests</title>
     1.8 +  <link rel="stylesheet" type="text/css"
     1.9 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.10 +
    1.11 +  <script type="application/javascript"
    1.12 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <script type="application/javascript"
    1.14 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    1.15 +
    1.16 +  <script type="application/javascript"
    1.17 +          src="../common.js"></script>
    1.18 +  <script type="application/javascript"
    1.19 +          src="../role.js"></script>
    1.20 +  <script type="application/javascript"
    1.21 +          src="../states.js"></script>
    1.22 +  <script type="application/javascript"
    1.23 +          src="../events.js"></script>
    1.24 +
    1.25 +  <script type="application/javascript">
    1.26 +    function openComboboxNCheckStates(aID)
    1.27 +    {
    1.28 +      this.combobox = getAccessible(aID);
    1.29 +      this.comboboxList = this.combobox.firstChild;
    1.30 +      this.comboboxOption = this.comboboxList.firstChild;
    1.31 +
    1.32 +      this.eventSeq = [
    1.33 +        new invokerChecker(EVENT_FOCUS, this.comboboxOption)
    1.34 +      ];
    1.35 +
    1.36 +      this.invoke = function openComboboxNCheckStates_invoke()
    1.37 +      {
    1.38 +        getNode(aID).focus();
    1.39 +        synthesizeKey("VK_DOWN", { altKey: true });
    1.40 +      }
    1.41 +
    1.42 +      this.finalCheck = function openComboboxNCheckStates_invoke()
    1.43 +      {
    1.44 +        // Expanded state on combobox.
    1.45 +        testStates(this.combobox, STATE_EXPANDED);
    1.46 +
    1.47 +        // Floating state on combobox list.
    1.48 +        testStates(this.comboboxList, STATE_FLOATING);
    1.49 +      }
    1.50 +
    1.51 +      this.getID = function openComboboxNCheckStates_getID()
    1.52 +      {
    1.53 +        return "open combobox and test states";
    1.54 +      }
    1.55 +    }
    1.56 +
    1.57 +    //gA11yEventDumpToConsole = true;
    1.58 +
    1.59 +    var gQueue = null;
    1.60 +    function doTest()
    1.61 +    {
    1.62 +      // combobox
    1.63 +      var combobox = getAccessible("combobox");
    1.64 +      testStates(combobox,
    1.65 +                 STATE_HASPOPUP | STATE_COLLAPSED | STATE_FOCUSABLE, 0,
    1.66 +                 STATE_FOCUSED, 0);
    1.67 +
    1.68 +      var comboboxList = combobox.firstChild;
    1.69 +      testStates(comboboxList, STATE_INVISIBLE, 0, STATE_FOCUSABLE, 0);
    1.70 +
    1.71 +      var opt1 = comboboxList.firstChild;
    1.72 +      testStates(opt1, STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE,
    1.73 +                 EXT_STATE_ACTIVE, STATE_FOCUSED, 0);
    1.74 +
    1.75 +      var opt2 = comboboxList.lastChild;
    1.76 +      testStates(opt2, STATE_SELECTABLE | STATE_FOCUSABLE, 0, STATE_SELECTED, 0,
    1.77 +                 STATE_FOCUSED, EXT_STATE_ACTIVE);
    1.78 +
    1.79 +      // collapsed combobox
    1.80 +      testStates("collapsedcombobox",
    1.81 +                 STATE_COLLAPSED | STATE_FOCUSABLE, 0,
    1.82 +                 STATE_FOCUSED, 0);
    1.83 +
    1.84 +      testStates("collapsed-1",
    1.85 +                 STATE_FOCUSABLE | STATE_SELECTABLE, 0,
    1.86 +                 STATE_OFFSCREEN | STATE_INVISIBLE, 0);
    1.87 +
    1.88 +      testStates("collapsed-2",
    1.89 +                 STATE_OFFSCREEN, 0,
    1.90 +                 STATE_INVISIBLE, 0);
    1.91 +
    1.92 +      // listbox
    1.93 +      testStates("listbox",
    1.94 +                 STATE_FOCUSABLE, 0,
    1.95 +                 STATE_HASPOPUP | STATE_COLLAPSED | STATE_FOCUSED);
    1.96 +
    1.97 +      testStates("listitem-active",
    1.98 +                 STATE_FOCUSABLE | STATE_SELECTABLE, EXT_STATE_ACTIVE,
    1.99 +                 STATE_SELECTED | STATE_FOCUSED);
   1.100 +
   1.101 +      testStates("listitem",
   1.102 +                 STATE_FOCUSABLE | STATE_SELECTABLE, 0,
   1.103 +                 STATE_SELECTED | STATE_FOCUSED, EXT_STATE_ACTIVE);
   1.104 +
   1.105 +      testStates("listitem-disabled",
   1.106 +                 STATE_UNAVAILABLE, 0,
   1.107 +                 STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE,
   1.108 +                 EXT_STATE_ACTIVE);
   1.109 +
   1.110 +      testStates("listgroup",
   1.111 +                 0, 0,
   1.112 +                 STATE_UNAVAILABLE | STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE,
   1.113 +                 EXT_STATE_ACTIVE);
   1.114 +
   1.115 +      testStates("listgroup-disabled",
   1.116 +                 STATE_UNAVAILABLE, 0,
   1.117 +                 STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE,
   1.118 +                 EXT_STATE_ACTIVE);
   1.119 +
   1.120 +      todo(false, "no unavailable state on option in disabled group (bug 759666)");
   1.121 +//      testStates("listitem-disabledgroup",
   1.122 +//                 STATE_UNAVAILABLE, 0,
   1.123 +//                 STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE,
   1.124 +//                 EXT_STATE_ACTIVE);
   1.125 +
   1.126 +      testStates("listbox-disabled",
   1.127 +                 STATE_UNAVAILABLE, 0,
   1.128 +                 STATE_FOCUSABLE);
   1.129 +
   1.130 +      todo(false, "no unavailable state on option in disabled select (bug 759666)");
   1.131 +//      testStates("listitem-disabledlistbox",
   1.132 +//                 STATE_UNAVAILABLE, 0,
   1.133 +//                 STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE,
   1.134 +//                 EXT_STATE_ACTIVE);
   1.135 +
   1.136 +      // open combobox
   1.137 +      gQueue = new eventQueue();
   1.138 +      gQueue.push(new openComboboxNCheckStates("combobox"));
   1.139 +      gQueue.invoke(); // Will call */SimpleTest.finish();
   1.140 +    }
   1.141 +
   1.142 +    SimpleTest.waitForExplicitFinish();
   1.143 +    addA11yLoadEvent(doTest);
   1.144 +  </script>
   1.145 +
   1.146 +</head>
   1.147 +
   1.148 +<body>
   1.149 +  <a target="_blank"
   1.150 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=443889"
   1.151 +     title="mochitest for selects and lists">
   1.152 +    Mozilla Bug 443889
   1.153 +  </a>
   1.154 +  <a target="_blank"
   1.155 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=640716"
   1.156 +     title="mochitest for selects and lists">
   1.157 +    Mozilla Bug 640716
   1.158 +  </a>
   1.159 +  <a target="_blank"
   1.160 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=689847"
   1.161 +     title="Expose active state on current item of selectable widgets">
   1.162 +    Mozilla Bug 689847
   1.163 +  </a>
   1.164 +  <a target="_blank"
   1.165 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=756983"
   1.166 +     title="Isolate focusable and unavailable states from State()">
   1.167 +    Mozilla Bug 756983
   1.168 +  </a>
   1.169 +  <a target="_blank"
   1.170 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=907682"
   1.171 +     title=" HTML:option group position is not correct when select is collapsed">
   1.172 +    Mozilla Bug 907682
   1.173 +  </a>
   1.174 +  <p id="display"></p>
   1.175 +  <div id="content" style="display: none"></div>
   1.176 +  <pre id="test">
   1.177 +  </pre>
   1.178 +
   1.179 +  <select id="combobox">
   1.180 +    <option>item 1</option>
   1.181 +    <option>item 2</option>
   1.182 +  </select>
   1.183 +
   1.184 +  <select id="collapsedcombobox">
   1.185 +    <option id="collapsed-1">item 1</option>
   1.186 +    <option id="collapsed-2">item 2</option>
   1.187 +  </select>
   1.188 +
   1.189 +  <select id="listbox" name="component" size="3">
   1.190 +    <option id="listitem-active">Build</option>
   1.191 +    <option id="listitem">Disability Access APIs</option>
   1.192 +    <option id="listitem-disabled" disabled>General</option>
   1.193 +    <optgroup id="listgroup" label="group">
   1.194 +      <option>option</option>
   1.195 +    </optgroup>
   1.196 +    <optgroup id="listgroup-disabled" disabled label="group2">
   1.197 +      <option id="listitem-disabledgroup">UI</option>
   1.198 +    </optgroup>
   1.199 +  </select>
   1.200 +
   1.201 +  <select id="listbox-disabled" size="3" disabled>
   1.202 +    <option id="listitem-disabledlistbox">option</option>
   1.203 +  </select>
   1.204 +
   1.205 +</body>
   1.206 +</html>

mercurial