diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /accessible/tests/mochitest/tree/test_combobox.xul | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'accessible/tests/mochitest/tree/test_combobox.xul')
-rw-r--r-- | accessible/tests/mochitest/tree/test_combobox.xul | 291 |
1 files changed, 291 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/tree/test_combobox.xul b/accessible/tests/mochitest/tree/test_combobox.xul new file mode 100644 index 000000000..79ce866dc --- /dev/null +++ b/accessible/tests/mochitest/tree/test_combobox.xul @@ -0,0 +1,291 @@ +<?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="Accessible XUL menulist and textbox @autocomplete hierarchy tests"> + + <script type="application/javascript" + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + + <script type="application/javascript" + src="../common.js" /> + <script type="application/javascript" + src="../role.js" /> + + <script type="application/javascript"> + <![CDATA[ + //////////////////////////////////////////////////////////////////////////// + // Test + + function doTest() + { + ////////////////////////////////////////////////////////////////////////// + // menulist + + var selectedOptionChildren = []; + if (MAC) { + // checkmark is part of the Mac menu styling + selectedOptionChildren = [{ + role: ROLE_STATICTEXT, + children: [] + }]; + } + + var accTree = { + role: ROLE_COMBOBOX, + children: [ + { + role: ROLE_COMBOBOX_LIST, + children: [ + { + role: ROLE_COMBOBOX_OPTION, + children: selectedOptionChildren + }, + { + role: ROLE_COMBOBOX_OPTION, + children: [] + } + ] + } + ] + }; + + testAccessibleTree("menulist", accTree); + + ////////////////////////////////////////////////////////////////////////// + // editable menulist + + accTree = { + role: ROLE_COMBOBOX, + children: [ + { + role: ROLE_ENTRY, + children: [ + // no text leaf accessible for text node + ] + }, + { + role: ROLE_COMBOBOX_LIST, // context menu + children: [] + }, + { + role: ROLE_PUSHBUTTON, // dropmarker + children: [] + }, + { + role: ROLE_COMBOBOX_LIST, // option list + children: [ + { + role: ROLE_COMBOBOX_OPTION, + children: [] + }, + { + role: ROLE_COMBOBOX_OPTION, + children: [] + } + ] + } + ] + }; + + if (!MAC) { + testAccessibleTree("menulist2", accTree); + } else { + todo(false, "Make this test pass on OSX (bug 551957)"); + } + + ////////////////////////////////////////////////////////////////////////// + // textbox@type=autocomplete #1 (history) + + accTree = { + // textbox + role: ROLE_AUTOCOMPLETE, + children: [ + { + // html:input + role: ROLE_ENTRY, + children: [ + { + // #text + role: ROLE_TEXT_LEAF, + name: "http://mochi.test:8888/redirect-a11y.html", + children: [] + } + ] + }, + { + // xul:menupopup + role: ROLE_COMBOBOX_LIST, // context menu popup + children: [] + } + ] + }; + + // XPFE and Toolkit autocomplete widgets differ. + var ac1h = document.getElementById("autocomplete"); + if ("clearResults" in ac1h) { + SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget. (ac1h)"); + + // Popup is always created. + accTree.children.push( + { + // xul:panel + role: ROLE_COMBOBOX_LIST, + children: [ + { + // xul:tree + role: ROLE_TABLE, + children: [ + { + // xul:treecols + role: ROLE_LIST, + children: [ + { + // xul:treecol + role: ROLE_COLUMNHEADER, + children: [] + } + ] + } + ] + } + ] + } + ); + } else { + SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget. (ac1h)"); + + // Popup is lazily created, so not present in this case. + } + + testAccessibleTree("autocomplete", accTree); + + ////////////////////////////////////////////////////////////////////////// + // textbox@type=autocomplete #2 (child menupoup) + + accTree = { + // textbox + role: ROLE_AUTOCOMPLETE, + children: [ + { + // menupopup + role: ROLE_COMBOBOX_LIST, // autocomplete menu popup + children: [ + { + // menuitem + role: ROLE_COMBOBOX_OPTION, + children: [] + } + ] + }, + { + // html:input + role: ROLE_ENTRY, + children: [ + // no text leaf accessible for text node + ] + }, + { + // xul:menupopup + role: ROLE_COMBOBOX_LIST, // context menu popup + children: [] + } + ] + }; + + // XPFE and Toolkit autocomplete widgets differ. + var ac2cmp = document.getElementById("autocomplete2"); + if ("clearResults" in ac2cmp) { + SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget. (ac2mp)"); + + // Popup is always created. + accTree.children.push( + { + // xul:panel + role: ROLE_COMBOBOX_LIST, + children: [ + { + // xul:tree + role: ROLE_TABLE, + children: [ + { + // xul:treecols + role: ROLE_LIST, + children: [ + { + // xul:treecol + role: ROLE_COLUMNHEADER, + children: [] + } + ] + } + ] + } + ] + } + ); + } else { + SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget. (ac2mp)"); + + // Popup is lazily created, so not present in this case. + } + + testAccessibleTree("autocomplete2", accTree); + + 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=249292" + title="Ensure accessible children for toolbarbutton types 'menu' and 'menu-button'"> + Mozilla Bug 249292 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=626660" + title="Cache rendered text on a11y side"> + Mozilla Bug 626660 + </a><br/> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + + <vbox flex="1"> + <menulist id="menulist"> + <menupopup> + <menuitem label="item"/> + <menuitem label="item"/> + </menupopup> + </menulist> + + <menulist id="menulist2" editable="true"> + <menupopup> + <menuitem label="item"/> + <menuitem label="item"/> + </menupopup> + </menulist> + + <textbox id="autocomplete" type="autocomplete" + autocompletesearch="unifiedcomplete" + value="http://mochi.test:8888/redirect-a11y.html"/> + + <textbox id="autocomplete2" type="autocomplete"> + <menupopup> + <menuitem label="item1"/> + </menupopup> + </textbox> + </vbox> + </hbox> + +</window> |