Backed out changeset db55605b2a4c (relanding bug 121341)
[wine-gecko.git] / accessible / tests / mochitest / test_groupattrs.xul
blob86e37940bf664aecba31a6d2e55c7fe8926bca3f
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="Accessibility Group Attributes ('level', 'setsize', 'posinset') Test.">
9 <script type="application/javascript"
10 src="chrome://mochikit/content/MochiKit/packed.js"></script>
11 <script type="application/javascript"
12 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
13 <script type="application/javascript">
14 <![CDATA[
15 var gAccService = null;
17 function accAttributes(aId)
19 this.getAttribute = function getAttribute(aName)
21 try {
22 return this.mAttrs.getStringProperty(aName);
23 } catch (e) {
24 return "";
28 this.mAcc = gAccService.getAccessibleFor(document.getElementById(aId));
29 ok(this.mAcc, "Can't get accessible for " + aId);
31 if (this.mAcc)
32 this.mAttrs = this.mAcc.attributes;
35 function testGroupAttrs(aID, aPosInSet, aSetSize, aLevel)
37 var attrs = new accAttributes(aID);
38 is(attrs.getAttribute("posinset"), aPosInSet, "Wrong posinset on " + aID);
39 is(attrs.getAttribute("setsize"), aSetSize, "Wrong setsize on " + aID);
40 if (aLevel)
41 is(attrs.getAttribute("level"), aLevel, "Wrong level on " + aID);
44 function doTest()
46 // Activate accessibility, otherwise events aren't fired.
47 gAccService = Components.classes["@mozilla.org/accessibleRetrieval;1"].
48 getService(Components.interfaces.nsIAccessibleRetrieval);
50 //////////////////////////////////////////////////////////////////////////
51 // xul:listbox (bug 417317)
52 testGroupAttrs("item1", "1", "2");
53 testGroupAttrs("item2", "2", "2");
55 //////////////////////////////////////////////////////////////////////////
56 // xul:menu (bug 443881)
57 var menu1 = document.getElementById("menu_item1");
58 menu1.open = true;
60 window.setTimeout(function() {
61 var menu2 = document.getElementById("menu_item2");
62 menu2.open = true;
64 window.setTimeout(function() {
65 testGroupAttrs("menu_item1.1", "1", "1");
66 testGroupAttrs("menu_item1.2", "1", "3");
67 testGroupAttrs("menu_item1.4", "2", "3");
68 testGroupAttrs("menu_item2", "3", "3");
69 testGroupAttrs("menu_item2.1", "1", "2", "1");
70 testGroupAttrs("menu_item2.2", "2", "2", "1");
72 SimpleTest.finish();
73 }, 0);
74 }, 0);
76 //////////////////////////////////////////////////////////////////////////
77 // ARIA menu (bug 441888)
78 testGroupAttrs("aria-menuitem", "1", "3");
79 testGroupAttrs("aria-menuitemcheckbox", "2", "3");
80 testGroupAttrs("aria-menuitemradio", "3", "3");
81 testGroupAttrs("aria-menuitem2", "1", "1");
84 SimpleTest.waitForExplicitFinish();
85 addLoadEvent(doTest);
86 ]]>
87 </script>
89 <body xmlns="http://www.w3.org/1999/xhtml">
90 <a target="_blank"
91 href="https://bugzilla.mozilla.org/show_bug.cgi?id=417317"
92 title="Certain types of LISTITEM accessibles no longer get attributes set like 'x of y', regression from fix for bug 389926">
93 Mozilla Bug 417317
94 </a><br/>
95 <a target="_blank"
96 href="https://bugzilla.mozilla.org/show_bug.cgi?id=443881"
97 title="take into account separators in xul menus when group attributes are calculating">
98 Mozilla Bug 443881
99 </a><br/>
100 <a target="_blank"
101 href="https://bugzilla.mozilla.org/show_bug.cgi?id=441888"
102 title="ARIA checked menu items are not included in the total list of menu items">
103 Mozilla Bug 441888
104 </a><br/>
106 <p id="display"></p>
107 <div id="content" style="display: none">
108 </div>
109 <pre id="test">
110 </pre>
111 </body>
113 <listbox>
114 <listitem label="item1" id="item1"/>
115 <listitem label="item2" id="item2"/>
116 </listbox>
118 <menubar>
119 <menu label="item1" id="menu_item1">
120 <menupopup>
121 <menuitem label="item1.1" id="menu_item1.1"/>
122 <menuseparator/>
123 <menuitem label="item1.2" id="menu_item1.2"/>
124 <menuitem label="item1.3" hidden="true"/>
125 <menuitem label="item1.4" id="menu_item1.4"/>
126 <menu label="item2" id="menu_item2">
127 <menupopup>
128 <menuitem label="item2.1" id="menu_item2.1"/>
129 <menuitem label="item2.2" id="menu_item2.2"/>
130 </menupopup>
131 </menu>
132 </menupopup>
133 </menu>
134 </menubar>
136 <vbox>
137 <description role="menuitem" id="aria-menuitem"
138 value="conventional menuitem"/>
139 <description role="menuitemcheckbox" id="aria-menuitemcheckbox"
140 value="conventional checkbox menuitem"/>
141 <description role="menuitem" hidden="true"/>
142 <description role="menuitemradio" id="aria-menuitemradio"
143 value="conventional radio menuitem"/>
144 <description role="separator"
145 value="conventional separator"/>
146 <description role="menuitem" id="aria-menuitem2"
147 value="conventional menuitem"/>
148 </vbox>
149 </window>