accessible/tests/mochitest/selectable/test_menulist.xul

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:24bf2aa07463
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"?>
5 <?xml-stylesheet href="../treeview.css" type="text/css"?>
6
7 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
8 title="XUL tree selectable tests">
9
10 <script type="application/javascript"
11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
12
13 <script type="application/javascript"
14 src="../common.js" />
15 <script type="application/javascript"
16 src="../role.js" />
17 <script type="application/javascript"
18 src="../states.js" />
19 <script type="application/javascript"
20 src="../selectable.js" />
21
22 <script type="application/javascript">
23 <![CDATA[
24
25 ////////////////////////////////////////////////////////////////////////////
26 // Test
27
28 //gA11yEventDumpID = "debug";
29
30 var gQueue = null;
31
32 function doTest()
33 {
34 //////////////////////////////////////////////////////////////////////////
35 // menulist aka combobox
36
37 var id = "combobox";
38 var combobox = getAccessible(id);
39 var comboboxList = combobox.firstChild;
40 ok(isAccessible(comboboxList, [nsIAccessibleSelectable]),
41 "No selectable accessible for list of " + id);
42
43 var select = getAccessible(comboboxList, [nsIAccessibleSelectable]);
44 testSelectableSelection(select, [ "cb1_item1" ]);
45
46 select.addItemToSelection(1);
47 testSelectableSelection(select, [ "cb1_item2" ], "addItemToSelection(1): ");
48
49 select.removeItemFromSelection(1);
50 testSelectableSelection(select, [ ],
51 "removeItemFromSelection(1): ");
52
53 is(select.selectAll(), false,
54 "No way to select all items in combobox '" + id + "'");
55 testSelectableSelection(select, [ ], "selectAll: ");
56
57 select.addItemToSelection(1);
58 select.unselectAll();
59 testSelectableSelection(select, [ ], "unselectAll: ");
60
61 SimpleTest.finish();
62 }
63
64 SimpleTest.waitForExplicitFinish();
65 addA11yLoadEvent(doTest);
66 ]]>
67 </script>
68
69 <hbox flex="1" style="overflow: auto;">
70 <body xmlns="http://www.w3.org/1999/xhtml">
71 <a target="_blank"
72 href="https://bugzilla.mozilla.org/show_bug.cgi?id=590176"
73 title="add pseudo SelectAccessible interface">
74 Mozilla Bug 590176
75 </a><br/>
76 <p id="display"></p>
77 <div id="content" style="display: none">
78 </div>
79 <pre id="test">
80 </pre>
81 </body>
82
83 <vbox flex="1">
84 <menulist id="combobox">
85 <menupopup>
86 <menuitem id="cb1_item1" label="item1"/>
87 <menuitem id="cb1_item2" label="item2"/>
88 </menupopup>
89 </menulist>
90
91 <vbox id="debug"/>
92 </vbox>
93 </hbox>
94
95 </window>
96

mercurial