accessible/tests/mochitest/tree/test_txtctrl.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
michael@0 4 type="text/css"?>
michael@0 5
michael@0 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 7 title="Accessible XUL textbox and textarea hierarchy tests">
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 11
michael@0 12 <script type="application/javascript"
michael@0 13 src="../common.js" />
michael@0 14 <script type="application/javascript"
michael@0 15 src="../role.js" />
michael@0 16 <script type="application/javascript"
michael@0 17 src="../events.js" />
michael@0 18
michael@0 19 <script type="application/javascript">
michael@0 20 <![CDATA[
michael@0 21 ////////////////////////////////////////////////////////////////////////////
michael@0 22 // Test
michael@0 23
michael@0 24 function doTest()
michael@0 25 {
michael@0 26 //////////////////////////////////////////////////////////////////////////
michael@0 27 // textboxes
michael@0 28
michael@0 29 var accTree =
michael@0 30 { SECTION: [
michael@0 31 { ENTRY: [ { TEXT_LEAF: [] } ] },
michael@0 32 { MENUPOPUP: [] }
michael@0 33 ] };
michael@0 34
michael@0 35 // default textbox
michael@0 36 testAccessibleTree("txc", accTree);
michael@0 37
michael@0 38 // multiline
michael@0 39 testAccessibleTree("txc_multiline", accTree);
michael@0 40
michael@0 41 //////////////////////////////////////////////////////////////////////////
michael@0 42 // search textbox
michael@0 43
michael@0 44 if (MAC) {
michael@0 45 accTree =
michael@0 46 { SECTION: [
michael@0 47 { ENTRY: [ { TEXT_LEAF: [] } ] },
michael@0 48 { MENUPOPUP: [] }
michael@0 49 ] };
michael@0 50 } else {
michael@0 51 accTree =
michael@0 52 { SECTION: [
michael@0 53 { ENTRY: [ { TEXT_LEAF: [] } ] },
michael@0 54 { PUSHBUTTON: [] },
michael@0 55 { MENUPOPUP: [] }
michael@0 56 ] };
michael@0 57 }
michael@0 58
michael@0 59 testAccessibleTree("txc_search", accTree);
michael@0 60
michael@0 61 //////////////////////////////////////////////////////////////////////////
michael@0 62 // number textbox
michael@0 63
michael@0 64 accTree =
michael@0 65 { SECTION: [
michael@0 66 { ENTRY: [ { TEXT_LEAF: [] } ] },
michael@0 67 { MENUPOPUP: [] },
michael@0 68 { PUSHBUTTON: [] },
michael@0 69 { PUSHBUTTON: [] }
michael@0 70 ] };
michael@0 71
michael@0 72 testAccessibleTree("txc_number", accTree);
michael@0 73
michael@0 74 //////////////////////////////////////////////////////////////////////////
michael@0 75 // password textbox
michael@0 76
michael@0 77 accTree =
michael@0 78 { SECTION: [
michael@0 79 { PASSWORD_TEXT: [ { TEXT_LEAF: [] } ] },
michael@0 80 { MENUPOPUP: [] }
michael@0 81 ] };
michael@0 82
michael@0 83 testAccessibleTree("txc_password", accTree);
michael@0 84
michael@0 85 //////////////////////////////////////////////////////////////////////////
michael@0 86 // autocomplete textbox
michael@0 87
michael@0 88 accTree = {
michael@0 89 // textbox
michael@0 90 role: ROLE_AUTOCOMPLETE,
michael@0 91 children: [
michael@0 92 {
michael@0 93 // html:input
michael@0 94 role: ROLE_ENTRY,
michael@0 95 children: [
michael@0 96 {
michael@0 97 // #text
michael@0 98 role: ROLE_TEXT_LEAF,
michael@0 99 children: []
michael@0 100 }
michael@0 101 ]
michael@0 102 },
michael@0 103 {
michael@0 104 // xul:menupopup
michael@0 105 role: ROLE_COMBOBOX_LIST,
michael@0 106 children: []
michael@0 107 }
michael@0 108 ]
michael@0 109 };
michael@0 110
michael@0 111 function test_AutocompleteControl() {
michael@0 112 testAccessibleTree("txc_autocomplete", accTree);
michael@0 113 SimpleTest.finish();
michael@0 114 }
michael@0 115
michael@0 116 // XPFE and Toolkit autocomplete widgets differ.
michael@0 117 var txc = document.getElementById("txc_autocomplete");
michael@0 118 if ("clearResults" in txc) {
michael@0 119 SimpleTest.ok(true, "Testing (Old) XPFE autocomplete widget.");
michael@0 120
michael@0 121 // Popup is always created. (See code below.)
michael@0 122
michael@0 123 accTree.children.push(
michael@0 124 {
michael@0 125 // xul:panel
michael@0 126 role: ROLE_COMBOBOX_LIST,
michael@0 127 children: [
michael@0 128 {
michael@0 129 // xul:tree
michael@0 130 role: ROLE_TABLE,
michael@0 131 children: [
michael@0 132 {
michael@0 133 // xul:treecols
michael@0 134 role: ROLE_LIST,
michael@0 135 children: [
michael@0 136 {
michael@0 137 // xul:treecol
michael@0 138 role: ROLE_COLUMNHEADER,
michael@0 139 children: []
michael@0 140 }
michael@0 141 ]
michael@0 142 }
michael@0 143 ]
michael@0 144 }
michael@0 145 ]
michael@0 146 }
michael@0 147 );
michael@0 148 test_AutocompleteControl();
michael@0 149
michael@0 150 } else {
michael@0 151 SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget.");
michael@0 152
michael@0 153 // Dumb access to trigger popup lazy creation.
michael@0 154 waitForEvent(EVENT_REORDER, txc, test_AutocompleteControl);
michael@0 155 txc.popup;
michael@0 156
michael@0 157 accTree.children.push(
michael@0 158 {
michael@0 159 role: ROLE_LIST,
michael@0 160 children: [
michael@0 161 {
michael@0 162 role: ROLE_LIST,
michael@0 163 children: [
michael@0 164 {
michael@0 165 role: ROLE_COLUMNHEADER,
michael@0 166 children: []
michael@0 167 }
michael@0 168 ]
michael@0 169 }
michael@0 170 ]
michael@0 171 }
michael@0 172 );
michael@0 173 }
michael@0 174 }
michael@0 175
michael@0 176 SimpleTest.waitForExplicitFinish();
michael@0 177 addA11yLoadEvent(doTest);
michael@0 178 ]]>
michael@0 179 </script>
michael@0 180
michael@0 181 <hbox flex="1" style="overflow: auto;">
michael@0 182 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 183 <a target="_blank"
michael@0 184 href="https://bugzilla.mozilla.org/show_bug.cgi?id=542824"
michael@0 185 title="Create child accessibles for text controls from native anonymous content">
michael@0 186 Mozilla Bug 542824
michael@0 187 </a><br/>
michael@0 188 <p id="display"></p>
michael@0 189 <div id="content" style="display: none">
michael@0 190 </div>
michael@0 191 <pre id="test">
michael@0 192 </pre>
michael@0 193 </body>
michael@0 194
michael@0 195 <vbox flex="1">
michael@0 196 <textbox id="txc" value="hello"/>
michael@0 197 <textbox id="txc_search" type="search" value="hello"/>
michael@0 198 <textbox id="txc_number" type="number" value="44"/>
michael@0 199 <textbox id="txc_password" type="password" value="hello"/>
michael@0 200 <textbox id="txc_multiline" multiline="true" value="hello"/>
michael@0 201 <textbox id="txc_autocomplete" type="autocomplete" value="hello"/>
michael@0 202 </vbox>
michael@0 203 </hbox>
michael@0 204
michael@0 205 </window>

mercurial