summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/attributes/test_obj_group.xhtml
blob: ba0c8bd35744c58b2a93d3c43d6c0385eaf30ea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
                 type="text/css"?>

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        title="Accessibility Group Attributes ('level', 'setsize', 'posinset') Test.">

  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />

  <script type="application/javascript"
          src="../common.js" />
  <script type="application/javascript"
          src="../events.js" />
  <script type="application/javascript"
          src="../attributes.js" />

  <script type="application/javascript">
  <![CDATA[
    function openMenu(aID)
    {
      this.menuNode = getNode(aID);

      this.eventSeq = [
        new invokerChecker(EVENT_FOCUS, this.menuNode)
      ];

      this.invoke = function openMenu_invoke()
      {
        this.menuNode.open = true;
      }

      this.finalCheck = function openMenu_finalCheck()
      {
        testGroupAttrs("menu_item1.1", 1, 1);
        testGroupAttrs("menu_item1.2", 1, 3);
        testGroupAttrs("menu_item1.4", 2, 3);
        testGroupAttrs("menu_item2", 3, 3);
      }

      this.getID = function openMenu_getID()
      {
        return "open menu " + prettyName(aID);
      }
    }

    function openSubMenu(aID)
    {
      this.menuNode = getNode(aID);

      this.eventSeq = [
        new invokerChecker(EVENT_FOCUS, this.menuNode)
      ];

      this.invoke = function openSubMenu_invoke()
      {
        this.menuNode.open = true;
      }

      this.finalCheck = function openSubMenu_finalCheck()
      {
        testGroupAttrs("menu_item2.1", 1, 2, 1);
        testGroupAttrs("menu_item2.2", 2, 2, 1);
      }

      this.getID = function openSubMenu_getID()
      {
        return "open submenu " + prettyName(aID);
      }
    }

    //gA11yEventDumpToConsole = true; // debug stuff

    var gQueue = null;
    function doTest()
    {
      //////////////////////////////////////////////////////////////////////////
      // xul:listbox (bug 417317)
      testGroupAttrs("listitem1", 1, 4);
      testGroupAttrs("listitem2", 2, 4);
      testGroupAttrs("listitem3", 3, 4);
      testGroupAttrs("listitem4", 4, 4);

      //////////////////////////////////////////////////////////////////////////
      // xul:tab
      testGroupAttrs("tab1", 1, 2);
      testGroupAttrs("tab2", 2, 2);

      //////////////////////////////////////////////////////////////////////////
      // xul:radio
      testGroupAttrs("radio1", 1, 2);
      testGroupAttrs("radio2", 2, 2);

      //////////////////////////////////////////////////////////////////////////
      // xul:menulist
      testGroupAttrs("menulist1.1", 1);
      testGroupAttrs("menulist1.2", 2);
      testGroupAttrs("menulist1.3", 3);
      testGroupAttrs("menulist1.4", 4);

      //////////////////////////////////////////////////////////////////////////
      // ARIA menu (bug 441888)
      testGroupAttrs("aria-menuitem", 1, 3);
      testGroupAttrs("aria-menuitemcheckbox", 2, 3);
      testGroupAttrs("aria-menuitemradio", 3, 3);
      testGroupAttrs("aria-menuitem2", 1, 1);

      //////////////////////////////////////////////////////////////////////////
      // xul:menu (bug 443881)
      gQueue = new eventQueue();
      gQueue.push(new openMenu("menu_item1"));
      gQueue.push(new openSubMenu("menu_item2"));
      gQueue.invoke(); // SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  ]]>
  </script>

  <hbox flex="1" style="overflow: auto;">
  <body xmlns="http://www.w3.org/1999/xhtml">
    <a target="_blank"
       href="https://bugzilla.mozilla.org/show_bug.cgi?id=417317"
       title="Certain types of LISTITEM accessibles no longer get attributes set like 'x of y', regression from fix for bug 389926">
      Mozilla Bug 417317
    </a><br/>
    <a target="_blank"
       href="https://bugzilla.mozilla.org/show_bug.cgi?id=443881"
       title="take into account separators in xul menus when group attributes are calculating">
      Mozilla Bug 443881
    </a><br/>
    <a target="_blank"
       href="https://bugzilla.mozilla.org/show_bug.cgi?id=441888"
       title="ARIA checked menu items are not included in the total list of menu items">
      Mozilla Bug 441888
    </a><br/>

    <p id="display"></p>
    <div id="content" style="display: none">
    </div>
    <pre id="test">
    </pre>
  </body>

  <vbox flex="1">

  <richlistbox>
    <richlistitem id="listitem1"/>
    <richlistitem id="listitem2"><label value="listitem2"/></richlistitem>
    <richlistitem id="listitem3"/>
    <richlistitem id="listitem4"><label value="listitem4"/></richlistitem>
  </richlistbox>

  <menubar>
    <menu label="item1" id="menu_item1">
      <menupopup>
        <menuitem label="item1.1" id="menu_item1.1"/>
        <menuseparator/>
        <menuitem label="item1.2" id="menu_item1.2"/>
        <menuitem label="item1.3" hidden="true"/>
        <menuitem label="item1.4" id="menu_item1.4"/>
        <menu label="item2" id="menu_item2">
          <menupopup>
            <menuitem label="item2.1" id="menu_item2.1"/>
            <menuitem label="item2.2" id="menu_item2.2"/>
          </menupopup>
        </menu>
      </menupopup>
    </menu>
  </menubar>

  <tabbox>
    <tabs>
      <tab id="tab1" label="tab1"/>
      <tab id="tab2" label="tab3"/>
    </tabs>
    <tabpanels>
      <tabpanel/>
      <tabpanel/>
    </tabpanels>
  </tabbox>

  <radiogroup>
    <radio id="radio1" label="radio1"/>
    <radio id="radio2" label="radio2"/>
  </radiogroup>

  <menulist id="menulist1" label="Vehicle">
    <menupopup>
      <menuitem id="menulist1.1" label="Car"/>
      <menuitem id="menulist1.2" label="Taxi"/>
      <menuitem id="menulist1.3" label="Bus" selected="true"/>
      <menuitem id="menulist1.4" label="Train"/>
    </menupopup>
  </menulist>

  <vbox>
    <div role="menu">
      <description role="menuitem" id="aria-menuitem"
                  value="conventional menuitem"/>
      <description role="menuitemcheckbox" id="aria-menuitemcheckbox"
                  value="conventional checkbox menuitem"/>
      <description role="menuitem" hidden="true"/>
      <description role="menuitemradio" id="aria-menuitemradio"
                  value="conventional radio menuitem"/>
      <description role="separator"
                  value="conventional separator"/>
      <description role="menuitem" id="aria-menuitem2"
                  value="conventional menuitem"/>
    </div>
  </vbox>

  </vbox>
  </hbox>
</window>