1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/selectable/test_menulist.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,96 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 +<?xml-stylesheet href="../treeview.css" type="text/css"?> 1.9 + 1.10 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.11 + title="XUL tree selectable tests"> 1.12 + 1.13 + <script type="application/javascript" 1.14 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.15 + 1.16 + <script type="application/javascript" 1.17 + src="../common.js" /> 1.18 + <script type="application/javascript" 1.19 + src="../role.js" /> 1.20 + <script type="application/javascript" 1.21 + src="../states.js" /> 1.22 + <script type="application/javascript" 1.23 + src="../selectable.js" /> 1.24 + 1.25 + <script type="application/javascript"> 1.26 + <![CDATA[ 1.27 + 1.28 + //////////////////////////////////////////////////////////////////////////// 1.29 + // Test 1.30 + 1.31 + //gA11yEventDumpID = "debug"; 1.32 + 1.33 + var gQueue = null; 1.34 + 1.35 + function doTest() 1.36 + { 1.37 + ////////////////////////////////////////////////////////////////////////// 1.38 + // menulist aka combobox 1.39 + 1.40 + var id = "combobox"; 1.41 + var combobox = getAccessible(id); 1.42 + var comboboxList = combobox.firstChild; 1.43 + ok(isAccessible(comboboxList, [nsIAccessibleSelectable]), 1.44 + "No selectable accessible for list of " + id); 1.45 + 1.46 + var select = getAccessible(comboboxList, [nsIAccessibleSelectable]); 1.47 + testSelectableSelection(select, [ "cb1_item1" ]); 1.48 + 1.49 + select.addItemToSelection(1); 1.50 + testSelectableSelection(select, [ "cb1_item2" ], "addItemToSelection(1): "); 1.51 + 1.52 + select.removeItemFromSelection(1); 1.53 + testSelectableSelection(select, [ ], 1.54 + "removeItemFromSelection(1): "); 1.55 + 1.56 + is(select.selectAll(), false, 1.57 + "No way to select all items in combobox '" + id + "'"); 1.58 + testSelectableSelection(select, [ ], "selectAll: "); 1.59 + 1.60 + select.addItemToSelection(1); 1.61 + select.unselectAll(); 1.62 + testSelectableSelection(select, [ ], "unselectAll: "); 1.63 + 1.64 + SimpleTest.finish(); 1.65 + } 1.66 + 1.67 + SimpleTest.waitForExplicitFinish(); 1.68 + addA11yLoadEvent(doTest); 1.69 + ]]> 1.70 + </script> 1.71 + 1.72 + <hbox flex="1" style="overflow: auto;"> 1.73 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.74 + <a target="_blank" 1.75 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=590176" 1.76 + title="add pseudo SelectAccessible interface"> 1.77 + Mozilla Bug 590176 1.78 + </a><br/> 1.79 + <p id="display"></p> 1.80 + <div id="content" style="display: none"> 1.81 + </div> 1.82 + <pre id="test"> 1.83 + </pre> 1.84 + </body> 1.85 + 1.86 + <vbox flex="1"> 1.87 + <menulist id="combobox"> 1.88 + <menupopup> 1.89 + <menuitem id="cb1_item1" label="item1"/> 1.90 + <menuitem id="cb1_item2" label="item2"/> 1.91 + </menupopup> 1.92 + </menulist> 1.93 + 1.94 + <vbox id="debug"/> 1.95 + </vbox> 1.96 + </hbox> 1.97 + 1.98 +</window> 1.99 +