| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
|---|
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
|---|
| 3 | <html> |
|---|
| 4 | <head> |
|---|
| 5 | <title>Dojo ComboBox Widget Test</title> |
|---|
| 6 | |
|---|
| 7 | <script type="text/javascript"> |
|---|
| 8 | var djConfig = { |
|---|
| 9 | isDebug: true}; |
|---|
| 10 | </script> |
|---|
| 11 | <script type="text/javascript" src="../../dojo.js"></script> |
|---|
| 12 | <script type="text/javascript"> |
|---|
| 13 | dojo.require("dojo.widget.ComboBox"); |
|---|
| 14 | function setVal1(val){ |
|---|
| 15 | dojo.byId('value1').value=val; |
|---|
| 16 | } |
|---|
| 17 | function setVal2(val){ |
|---|
| 18 | dojo.byId('value2').value=val; |
|---|
| 19 | } |
|---|
| 20 | function setVal3(val){ |
|---|
| 21 | dojo.byId('value3').value=val; |
|---|
| 22 | } |
|---|
| 23 | var combo; |
|---|
| 24 | dojo.addOnLoad(init); |
|---|
| 25 | function init(){ |
|---|
| 26 | combo = dojo.widget.createWidget("dojo:ComboBox", {name:"prog",autocomplete:false,dataUrl:"comboBoxData.js"}, dojo.byId("progCombo")); |
|---|
| 27 | } |
|---|
| 28 | </script> |
|---|
| 29 | <script> |
|---|
| 30 | function toggleDisabled(button, widget){ |
|---|
| 31 | widget = dojo.widget.byId(widget); |
|---|
| 32 | button = dojo.byId(button); |
|---|
| 33 | widget.disabled ? widget.enable() : widget.disable(); |
|---|
| 34 | button.innerHTML= widget.disabled ? "Enable" : "Disable"; |
|---|
| 35 | } |
|---|
| 36 | </script> |
|---|
| 37 | <style> |
|---|
| 38 | .myComboBox .dojoComboBoxDownArrow { |
|---|
| 39 | border-top-color: red; |
|---|
| 40 | } |
|---|
| 41 | .myComboBox .dojoComboBoxButton { |
|---|
| 42 | background-color: yellow; |
|---|
| 43 | } |
|---|
| 44 | .myComboBox .dojoComboBoxButtonPushed .dojoComboBoxDownArrow { |
|---|
| 45 | border-top-color: blue; |
|---|
| 46 | } |
|---|
| 47 | </style> |
|---|
| 48 | |
|---|
| 49 | </head> |
|---|
| 50 | |
|---|
| 51 | <body> |
|---|
| 52 | <h1>Dojo ComboBox Widget Test</h1> |
|---|
| 53 | <p> |
|---|
| 54 | A combobox is like a text <input> field (ie, you can input any value you want), |
|---|
| 55 | but it also has a list of suggested values that you can choose from. |
|---|
| 56 | The drop down list is filtered by the data you have already typed in. |
|---|
| 57 | </p> |
|---|
| 58 | <form action="#" method="GET"> |
|---|
| 59 | |
|---|
| 60 | <p>ComboBox #1: inlined data, autocomplete=false, default value of CA (California)</p> |
|---|
| 61 | <select name="state" dojoType="combobox" class="myComboBox" style="width: 300px;font-size:20pt;background-color:cyan;" name="foo.bar1" autocomplete="false" |
|---|
| 62 | onValueChanged="setVal1" |
|---|
| 63 | > |
|---|
| 64 | <option value="AL">Alabama</option> |
|---|
| 65 | <option value="AK">Alaska</option> |
|---|
| 66 | <option value="AS">American Samoa</option> |
|---|
| 67 | <option value="AZ">Arizona</option> |
|---|
| 68 | <option value="AR">Arkansas</option> |
|---|
| 69 | <option value="AE">Armed Forces Europe</option> |
|---|
| 70 | <option value="AP">Armed Forces Pacific</option> |
|---|
| 71 | <option value="AA">Armed Forces the Americas</option> |
|---|
| 72 | <option value="CA" selected>California</option> |
|---|
| 73 | <option value="CO">Colorado</option> |
|---|
| 74 | <option value="CT">Connecticut</option> |
|---|
| 75 | <option value="DE">Delaware</option> |
|---|
| 76 | <option value="DC">District of Columbia</option> |
|---|
| 77 | <option value="FM">Federated States of Micronesia</option> |
|---|
| 78 | <option value="FL">Florida</option> |
|---|
| 79 | <option value="GA">Georgia</option> |
|---|
| 80 | <option value="GU">Guam</option> |
|---|
| 81 | <option value="HI">Hawaii</option> |
|---|
| 82 | <option value="ID">Idaho</option> |
|---|
| 83 | <option value="IL">Illinois</option> |
|---|
| 84 | <option value="IN">Indiana</option> |
|---|
| 85 | <option value="IA">Iowa</option> |
|---|
| 86 | <option value="KS">Kansas</option> |
|---|
| 87 | <option value="KY">Kentucky</option> |
|---|
| 88 | <option value="LA">Louisiana</option> |
|---|
| 89 | <option value="ME">Maine</option> |
|---|
| 90 | <option value="MH">Marshall Islands</option> |
|---|
| 91 | <option value="MD">Maryland</option> |
|---|
| 92 | <option value="MA">Massachusetts</option> |
|---|
| 93 | <option value="MI">Michigan</option> |
|---|
| 94 | <option value="MN">Minnesota</option> |
|---|
| 95 | <option value="MS">Mississippi</option> |
|---|
| 96 | <option value="MO">Missouri</option> |
|---|
| 97 | <option value="MT">Montana</option> |
|---|
| 98 | <option value="NE">Nebraska</option> |
|---|
| 99 | <option value="NV">Nevada</option> |
|---|
| 100 | <option value="NH">New Hampshire</option> |
|---|
| 101 | <option value="NJ">New Jersey</option> |
|---|
| 102 | <option value="NM">New Mexico</option> |
|---|
| 103 | <option value="NY">New York</option> |
|---|
| 104 | <option value="NC">North Carolina</option> |
|---|
| 105 | <option value="ND">North Dakota</option> |
|---|
| 106 | <option value="MP">Northern Mariana Islands</option> |
|---|
| 107 | <option value="OH">Ohio</option> |
|---|
| 108 | <option value="OK">Oklahoma</option> |
|---|
| 109 | <option value="OR">Oregon</option> |
|---|
| 110 | <option value="PA">Pennsylvania</option> |
|---|
| 111 | <option value="PR">Puerto Rico</option> |
|---|
| 112 | <option value="RI">Rhode Island</option> |
|---|
| 113 | <option value="SC">South Carolina</option> |
|---|
| 114 | <option value="SD">South Dakota</option> |
|---|
| 115 | <option value="TN">Tennessee</option> |
|---|
| 116 | <option value="TX">Texas</option> |
|---|
| 117 | <option value="UT">Utah</option> |
|---|
| 118 | <option value="VT">Vermont</option> |
|---|
| 119 | <option value="VI">Virgin Islands, U.S.</option> |
|---|
| 120 | <option value="VA">Virginia</option> |
|---|
| 121 | <option value="WA">Washington</option> |
|---|
| 122 | <option value="WV">West Virginia</option> |
|---|
| 123 | <option value="WI">Wisconsin</option> |
|---|
| 124 | <option value="WY">Wyoming</option> |
|---|
| 125 | </select> |
|---|
| 126 | <br> |
|---|
| 127 | <div>Value: <input id="value1" disabled></div> |
|---|
| 128 | <hr> |
|---|
| 129 | |
|---|
| 130 | <p>ComboBox #2: dataUrl, autocomplete=true:</p> |
|---|
| 131 | <input dojoType="ComboBox" value="this should never be seen - it is replaced!" |
|---|
| 132 | dataUrl="comboBoxData.js" style="width: 300px;" name="foo.bar" |
|---|
| 133 | onValueChanged="setVal2" |
|---|
| 134 | > |
|---|
| 135 | <br> |
|---|
| 136 | <div>Value: <input id="value2" disabled></div> |
|---|
| 137 | <hr> |
|---|
| 138 | |
|---|
| 139 | <p>ComboBox #3: initially disabled, dataUrl, autocomplete=false:</p> |
|---|
| 140 | <input id="combo3" dojoType="ComboBox" value="this should never be seen - it is replaced!" |
|---|
| 141 | dataUrl="comboBoxData.js" style="width: 300px;" name="foo.bar" autocomplete="false" |
|---|
| 142 | onValueChanged="setVal3" disabled |
|---|
| 143 | > |
|---|
| 144 | <br> |
|---|
| 145 | <div>Value: <input id="value3" disabled></div> |
|---|
| 146 | <div> |
|---|
| 147 | <button id="but" onclick='toggleDisabled("but", "combo3")'>Enable</button> |
|---|
| 148 | </div> |
|---|
| 149 | <hr> |
|---|
| 150 | |
|---|
| 151 | <p>Remote mode combobox</p> |
|---|
| 152 | <p> |
|---|
| 153 | Clicking any letter in the box below will display a select-list generated from user specified java code. |
|---|
| 154 | Note that the same select-list is always displayed. |
|---|
| 155 | This isn't a dojo bug; it's just because remoteComboBoxData.js (our dummy test code) |
|---|
| 156 | isn't filtering based on the search string like it should. |
|---|
| 157 | </p> |
|---|
| 158 | |
|---|
| 159 | <input dojoType="combobox" value="this should be replaced!" |
|---|
| 160 | dataUrl="remoteComboBoxData.js?search=${searchString}" mode="remote"> |
|---|
| 161 | <hr> |
|---|
| 162 | |
|---|
| 163 | <p>Key value JSON object</p> |
|---|
| 164 | <input dojoType="ComboBox" value="this should never be seen - it is replaced!" |
|---|
| 165 | dataUrl="comboBoxDataKeyValue.js" style="width: 300px;" name="foo.bar"> |
|---|
| 166 | <hr> |
|---|
| 167 | |
|---|
| 168 | <p>Multiple combo boxes on a single line:</p> |
|---|
| 169 | <input dojoType="ComboBox" value="this should never be seen - it is replaced!" |
|---|
| 170 | dataUrl="comboBoxData.js" style="width: 200px;" name="foo.bar" autocomplete="false" |
|---|
| 171 | > |
|---|
| 172 | <input dojoType="ComboBox" value="this should never be seen - it is replaced!" |
|---|
| 173 | dataUrl="comboBoxData.js" style="width: 200px;" name="foo.bar" autocomplete="false" |
|---|
| 174 | > |
|---|
| 175 | <hr> |
|---|
| 176 | |
|---|
| 177 | <p>A combo created by createWidget</p> |
|---|
| 178 | <input id="progCombo"> |
|---|
| 179 | <hr> |
|---|
| 180 | |
|---|
| 181 | <input type="submit"> |
|---|
| 182 | |
|---|
| 183 | </form> |
|---|
| 184 | <p> |
|---|
| 185 | this is some text below the combo boxes. It shouldn't get pushed out of the way when search results get returned. |
|---|
| 186 | also: adding a simple combo box to test IE bleed through problem: |
|---|
| 187 | </p> |
|---|
| 188 | |
|---|
| 189 | <select> |
|---|
| 190 | <option>test for</option> |
|---|
| 191 | <option>IE bleed through</option> |
|---|
| 192 | <option>problem</option> |
|---|
| 193 | </select> |
|---|
| 194 | <h3>Some tests:</h3> |
|---|
| 195 | <ol> |
|---|
| 196 | <li>Note: This is not really a ComboBox - it is actually an AutoCompleter.</li> |
|---|
| 197 | <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> |
|---|
| 198 | <li>Type in DX - input box shows DX and no dropdown.</li> |
|---|
| 199 | <li>Open dropdown, click an item, it selects and closes dropdown.</li> |
|---|
| 200 | <li>Click triangle icon - dropdown shows. Click it again - dropdown goes.</li> |
|---|
| 201 | <li>Check that you can type in more than required (e.g. alaba for alabama) and it still correctly shows alabama</li> |
|---|
| 202 | <li>Tab into the combo works, list should not apear.</li> |
|---|
| 203 | <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> |
|---|
| 204 | <li>Do the dropdown and click outside of it - the dropdown disappears.</li> |
|---|
| 205 | <li>Javascript disabled -> fallback to old style combo?</li> |
|---|
| 206 | <li>Can you paste in the start of a match? [no]</li> |
|---|
| 207 | <li>Backspace to start - dropdown shows all all items</li> |
|---|
| 208 | <li>Backspace deselects last character [Borked: currently you have to backspace twice]</li> |
|---|
| 209 | <li>Press down key to open dropdown</li> |
|---|
| 210 | <li>Down and up keys select previous/next in dropdown.</li> |
|---|
| 211 | <li>Non-alpha keys (F12, ctrl-c, whatever) should not affect dropdown.</li> |
|---|
| 212 | <li>Press down arrow to highlight an item, pressing enter selects it and closes dropdown.</li> |
|---|
| 213 | <li>Press down arrow to highlight an item, pressing space selects it and closes dropdown.</li> |
|---|
| 214 | <li>Check that pressing escape undoes the previous action and closes the dropdown</li> |
|---|
| 215 | <li>Check that pressing escape again clears the input box.</li> |
|---|
| 216 | <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> |
|---|
| 217 | <li>In IE, dropdown list does not go behind the second combo (special code to manage this).</li> |
|---|
| 218 | <li>Check dropdown is aligned correctly with bottom of the text input</li> |
|---|
| 219 | <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> |
|---|
| 220 | <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> |
|---|
| 221 | <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> |
|---|
| 222 | <li>Check that dropdown is smooth [looks uggy on second keypress in FF - hides then shows]</li> |
|---|
| 223 | <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> |
|---|
| 224 | <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> |
|---|
| 225 | <li>(Add any other tests here)</li> |
|---|
| 226 | </ol> |
|---|
| 227 | <!-- maintain state of combo box if user presses back/forward button --> |
|---|
| 228 | <form name="_dojo_form" style="display:none" disabled="true"><textarea name="stabile" cols="80" rows="10"></textarea></form> |
|---|
| 229 | </body> |
|---|
| 230 | </html> |
|---|