1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
5 <title>Dojo ComboBox Widget Test</title>
8 @import "../../../dojo/resources/dojo.css";
9 @import "../css/dijitTests.css";
10 .dj_ie INPUT#setvaluetest { font-family: Courier; } /* help IE with font inheritance
13 <script type="text/javascript" src="../../../dojo/dojo.js"
14 djConfig="isDebug: true, parseOnLoad: true"></script>
15 <script type="text/javascript" src="../_testCommon.js"></script>
17 <script type="text/javascript">
18 dojo.require("dojo.data.ItemFileReadStore");
19 dojo.require("dijit.form.ComboBox");
20 dojo.require("dojo.parser"); // scan page for widgets and instantiate them
22 function setVal1(val){
23 dojo.byId('value1').value=val;
25 function setVal2(val){
26 dojo.byId('value2').value=val;
27 console.debug("Value changed to ["+val+"] in second ComboBox (#1652)");
29 function setVal3(val){
30 dojo.byId('value3').value=val;
32 function setVal4(val){
33 dojo.byId('value4').value=val;
37 var store = new dojo.data.ItemFileReadStore({url: '../_data/states.json'});
38 combo = new dijit.form.ComboBox({
43 }, dojo.byId("progCombo"));
45 var store2 = new dojo.data.ItemFileReadStore({url: '../../demos/i18n/data.json'});
46 combo = new dijit.form.ComboBox({
50 query:{type:'country'},
52 }, dojo.byId("progCombo2"));
56 function toggleDisabled(button, widget){
57 widget = dijit.byId(widget);
58 button = dojo.byId(button);
59 widget.setAttribute('disabled',!widget.disabled);
60 button.innerHTML= widget.disabled ? "Enable" : "Disable";
66 <h1>Dojo ComboBox Widget Test</h1>
68 A ComboBox is like a text <input> field (ie, you can input any value you want),
69 but it also has a list of suggested values that you can choose from.
70 The drop down list is filtered by the data you have already typed in.
72 <form action="#" method="GET">
74 <p>ComboBox #1: inlined data, autoComplete=false, default value of Iowa, pageSize=30</p>
75 <label for="setvaluetest">US State test 1</label> (200% Courier font):
76 <select id="setvaluetest"
78 dojoType="dijit.form.ComboBox"
80 style="width:50%;font-size:200%;font-family:Courier;"
83 onChange="dojo.byId('oc1').value=arguments[0]"
87 <option>Alabama</option>
88 <option>Alaska</option>
89 <option>American Samoa</option>
90 <option>Arizona</option>
91 <option>Arkansas</option>
92 <option>Armed Forces Europe</option>
93 <option>Armed Forces Pacific</option>
94 <option>Armed Forces the Americas</option>
95 <option>California</option>
96 <option>Colorado</option>
97 <option>Connecticut</option>
98 <option>Delaware</option>
99 <option>District of Columbia</option>
100 <option>Federated States of Micronesia</option>
101 <option>Florida</option>
102 <option>Georgia</option>
103 <option>Guam</option>
104 <option>Hawaii</option>
105 <option>Idaho</option>
106 <option>Illinois</option>
107 <option>Indiana</option>
108 <option selected>Iowa</option>
109 <option>Kansas</option>
110 <option>Kentucky</option>
111 <option>Louisiana</option>
112 <option>Maine</option>
113 <option>Marshall Islands</option>
114 <option>Maryland</option>
115 <option>Massachusetts</option>
116 <option>Michigan</option>
117 <option>Minnesota</option>
118 <option>Mississippi</option>
119 <option>Missouri</option>
120 <option>Montana</option>
121 <option>Nebraska</option>
122 <option>Nevada</option>
123 <option>New Hampshire</option>
124 <option>New Jersey</option>
125 <option>New Mexico</option>
126 <option>New York</option>
127 <option>North Carolina</option>
128 <option>North Dakota</option>
129 <option>Northern Mariana Islands</option>
130 <option>Ohio</option>
131 <option>Oklahoma</option>
132 <option>Oregon</option>
133 <option>Pennsylvania</option>
134 <option>Puerto Rico</option>
135 <option>Rhode Island</option>
136 <option>South Carolina</option>
137 <option>South Dakota</option>
138 <option>Tennessee</option>
139 <option>Texas</option>
140 <option>Utah</option>
141 <option>Vermont</option>
142 <option>Virgin Islands, U.S.</option>
143 <option>Virginia</option>
144 <option>Washington</option>
145 <option>West Virginia</option>
146 <option>Wisconsin</option>
147 <option>Wyoming</option>
149 <br>onChange:<input id="oc1" disabled value="not fired yet!" autocomplete="off">
150 <input type="button" value="Set displayed value to Kentucky" onClick="dijit.byId('setvaluetest').setDisplayedValue('Kentucky')">
151 <input type="button" value="Set displayed value to Canada" onClick="dijit.byId('setvaluetest').setDisplayedValue('Canada')">
155 <div dojoType="dojo.data.ItemFileReadStore" jsId="stateStore"
156 url="../_data/states.json"></div>
158 <div dojoType="dojo.data.ItemFileReadStore" jsId="dijitStore"
159 url="../_data/dijits.json"></div>
161 <p>ComboBox #2: url, autoComplete=true:</p>
162 <label for="datatest">US State test 2</label> (8pt font):
163 <input dojoType="dijit.form.ComboBox"
168 style="width: 200px; font-size: 8pt;"
173 <span>Value: <input id="value2" disabled value="California"></span>
175 <label for="datatestDijit">Dijit List test #1</label> (150% font):
176 <input dojoType="dijit.form.ComboBox"
180 searchAttr="className"
181 style="width: 200px; font-size: 150%;"
185 <span>Hey look, this one is kind of useful.</span>
188 <p>ComboBox #3: initially disabled, url, autoComplete=false:</p>
189 <label for="combo3">US State test 3: </label>
191 dojoType="dijit.form.ComboBox"
196 style="width: 300px;"
202 <span>Value: <input id="value3" disabled></span>
204 <button id="but" onclick='toggleDisabled("but", "combo3"); return false;'>Enable</button>
207 <p>ComboBox #4: url, autoComplete=false required=true:</p>
208 <label for="combobox4">US State test 4: </label>
209 <input dojoType="dijit.form.ComboBox"
214 style="width: 300px;"
221 <span>Value: <input id="value4" disabled></span>
223 <p>A ComboBox with no arrow</p>
224 <input dojoType="dijit.form.ComboBox"
233 <p>A combo created by createWidget</p>
234 <input id="progCombo">
236 <p>A ComboBox with an initial query. (Limits list to items with type = country.)</p>
237 <input id="progCombo2">
239 <input type="button" value="Create one in a window" onclick="var win=window.open(window.location);"></input>
240 <input type="submit">
244 This is some text below the ComboBoxes. It shouldn't get pushed out of the way when search results get returned.
245 also: adding a simple combo box to test IE bleed through problem:
249 <option>test for</option>
250 <option>IE bleed through</option>
251 <option>problem</option>
255 <li>Type in D - dropdown shows Delaware and District of columbia. [Would be nice if it bolded the D's in the dropdown list!]</li>
256 <li>Type in DX - input box shows DX and no dropdown.</li>
257 <li>Open dropdown, click an item, it selects and closes dropdown.</li>
258 <li>Click triangle icon - dropdown shows. Click it again - dropdown goes.</li>
259 <li>Check that you can type in more than required (e.g. alaba for alabama) and it still correctly shows alabama</li>
260 <li>Tab into the combo works, list should not apear.</li>
261 <li>Tab out of the combo works - closes dropdown and goes to next control (focus should not go to the dropdown because tabindex="-1").</li>
262 <li>Do the dropdown and click outside of it - the dropdown disappears.</li>
263 <li>Javascript disabled -> fallback to old style combo?</li>
264 <li>Can you paste in the start of a match? [no]</li>
265 <li>Backspace to start - dropdown shows all all items</li>
266 <li>Backspace deselects last character [Borked: currently you have to backspace twice]</li>
267 <li>Press down key to open dropdown</li>
268 <li>Down and up keys select previous/next in dropdown.</li>
269 <li>Non-alpha keys (F12, ctrl-c, whatever) should not affect dropdown.</li>
270 <li>Press down arrow to highlight an item, pressing enter selects it and closes dropdown.</li>
271 <li>Press down arrow to highlight an item, pressing space selects it and closes dropdown.</li>
272 <li>Check that pressing escape undoes the previous action and closes the dropdown</li>
273 <li>Check that pressing escape again clears the input box.</li>
274 <li>In IE, mouse scroll wheel scrolls through the list. Scrolls by 1 item per click even if user has set mouse to scroll more than 1 in mouse settings. Only scrolls if text input has focus (page scrolling works as normal otherwise)</li>
275 <li>In IE, dropdown list does not go behind the second combo (special code to manage this).</li>
276 <li>Check dropdown is aligned correctly with bottom of the text input</li>
277 <li>Probably should try the combo in a relative div or absolute div and see where the dropdown ends up. (Strongly suspect problems in this area in IE - boo)</li>
278 <li>Try repeatably droppingdown and closing the dropdown. Shouldnt get hung [sometimes flicks closed just after opening due to timers, but not a biggie]</li>
279 <li>Check that default selection of the text makes sense. e.g. text is selected after picking an item, on tabbing in to text input etc)</li>
280 <li>Check that dropdown is smooth [looks uggy on second keypress in FF - hides then shows]</li>
281 <li>Clear the field. Type in A and then tab *very quickly* and see if the results make sense (the dropdown is on a timer - searchTimer)</li>
282 <li>Clear the field and enter an invalid entry and tab out e.g. Qualude. Does that make sense given the combobox setup options?</li>
283 <li>(Add any other tests here)</li>
285 <div id="debugbox"></div>
286 <!-- maintain state of combo box if user presses back/forward button -->
287 <form name="_dojo_form" style="display:none" disabled="true"><textarea name="stabile" cols="80" rows="10"></textarea></form>