Debian Codegraph @

dijit/tests/form/TextBox_sizes.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html dir="ltr" lang="en">
3 <head>
4 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5 <title>dijit.form.TextBox size tests</title>
6
7 <style type="text/css">
8 @import "../../themes/claro/document.css";
9 @import "../../themes/dijit.css";
10 @import "../../themes/dijit_rtl.css";
11 @import "../../themes/tundra/Common.css";
12 @import "../../themes/tundra/form/Button.css";
13 @import "../../themes/tundra/form/Common.css";
14 @import "../../themes/tundra/form/Select.css";
15 @import "../../themes/claro/Common.css";
16 @import "../../themes/claro/form/Button.css";
17 @import "../../themes/claro/form/Button_rtl.css";
18 @import "../../themes/claro/form/Common.css";
19 @import "../../themes/claro/form/Common_rtl.css";
20 @import "../../themes/claro/form/NumberSpinner.css";
21 @import "../../themes/claro/form/Select.css";
22 @import "../../themes/soria/Common.css";
23 @import "../../themes/soria/form/Button.css";
24 @import "../../themes/soria/form/Button_rtl.css";
25 @import "../../themes/soria/form/Common.css";
26 @import "../../themes/soria/form/Select.css";
27 @import "../../themes/nihilo/Common.css";
28 @import "../../themes/nihilo/form/Button.css";
29 @import "../../themes/nihilo/form/Button_rtl.css";
30 @import "../../themes/nihilo/form/Common.css";
31 @import "../../themes/nihilo/form/Select.css";
32
33 .dijitTextBox,
34 .dijitSelect {
35 box-sizing: border-box !important;
36 -moz-box-sizing: border-box !important;
37 width: 330px !important;
38 }
39 .dj_ie6 .dijitSelect,
40 .dj_ie7 .dijitSelect {
41 width: 332px !important; /* lack of box-sizing support */
42 }
43 .dj_iequirks .dijitSelect {
44 width: 330px !important; /* lack of box-sizing support */
45 }
46 #table > TBODY > TR > TD {
47 background-color: pink;
48 font-size: 100%;
49 padding: 0;
50 margin: 0;
51 }
52 TABLE#table, #table > TBODY > TR > TD, .dijit {
53 margin: 0 !important;
54 }
55 #table .dijit {
56 vertical-align: bottom;
57 }
58 .dj_ie9 table.dijitSelect {
59 border-width: thin !important; /* needed for IE9 strict bug since 1px table border only measures 0.8px */
60 }
61 .dj_iequirks.dj_ie9 table.dijitSelect {
62 border-width: 1px !important; /* needed for IE9 quirks due to strict rule above */
63 }
64 .padded .dijitInputField {
65 padding: 10px !important;
66 }
67 .unPadded .dijitInputField {
68 padding: 0 !important;
69 }
70 #table {
71 padding: 0;
72 border:1px solid black;
73 background-color: pink;
74 }
75 #table .layout {
76 padding: 1px;
77 border: 1px solid black;
78 }
79 .dj_a11y, /* a11y emulation rules */
80 .dj_a11y * {
81 background: white none !important;
82 border-color: black !important;
83 color: black !important;
84 }
85 </style>
86
87 <script type="text/javascript" src="../../../dojo/dojo.js"
88 data-dojo-config="parseOnLoad: true, isDebug: true"></script>
89
90 <script type="text/javascript">
91 dojo.require("doh.runner");
92 dojo.require("dijit.dijit"); // optimize: load dijit layer
93 dojo.require("dijit.form.TextBox");
94 dojo.require("dijit.form.NumberTextBox");
95 dojo.require("dijit.form.ComboBox");
96 dojo.require("dijit.form.FilteringSelect");
97 dojo.require("dijit.form.NumberSpinner");
98 dojo.require("dijit.form.Select");
99 dojo.require("dijit.form.Button");
100
101 dojo.ready(function(){
102
103 var padding = "padded";
104 var theme = "claro";
105 var direction = "ltr";
106 var fontSize = "12pt";
107 var fontFamily = "monospace";
108
109 dijit.byId("theme").isRealA11y = dojo.hasClass(dojo.body(), "dj_a11y");
110
111 var str = window.location.href.substr(window.location.href.indexOf("?")+1).split(/#/);
112 var ary = str[0].split(/&/);
113 if(window.location.href.indexOf("?") > -1){
114 for(var i=0; i<ary.length; i++){
115 var split = ary[i].split("="),
116 key = split[0],
117 value = split[1].replace(/[^\w]/g, ""); // replace() to prevent XSS attack
118 switch(key){
119 case "locale":
120 // locale string | null
121 dojo.locale = dojo.config.locale = locale = value;
122 break;
123 case "dir":
124 case "direction":
125 // rtl | ltr
126 direction = value;
127 break;
128 case "theme":
129 // tundra | soria | nihilo | claro | a11y
130 theme = value;
131 break;
132 case "a11y": // included for backward compat
133 theme = "a11y";
134 break;
135 case "size":
136 case "fontsize":
137 case "fontSize":
138 // size string (e.g 12px)
139 fontSize = value;
140 break;
141 case "family":
142 case "fontfamily":
143 case "fontFamily":
144 // family string (e.g monospace)
145 fontFamily = value;
146 break;
147 case "padding":
148 // padded | unPadded | default
149 padding = value;
150 break;
151 }
152 }
153 }
154
155 dijit.byId('padding').set('value', padding, true);
156 dijit.byId('theme').set('value', theme, true);
157 dijit.byId('direction').set('value', direction, true);
158 dijit.byId('fontSize').set('value', fontSize, true);
159 dijit.byId('fontFamily').set('value', fontFamily, true);
160
161 var textbox = dijit.byId("textbox"),
162 validation = dijit.byId("validation"),
163 combobox = dijit.byId("combobox"),
164 select = dijit.byId("select"),
165 spinner = dijit.byId("spinner");
166
167 var compareToTextBox = function(attr){
168 try{
169 var
170 attrMap = {
171 x: 'offsetLeft',
172 h: 'offsetHeight',
173 w: 'offsetWidth'
174 },
175 textboxNode = textbox.domNode,
176 validationNode = validation.domNode,
177 comboboxNode = combobox.domNode,
178 selectNode = select.domNode,
179 spinnerNode = spinner.domNode,
180 textboxPos = dojo.position(textboxNode),
181 validationPos = dojo.position(validationNode),
182 comboboxPos = dojo.position(comboboxNode),
183 selectPos = dojo.position(selectNode),
184 spinnerPos = dojo.position(spinnerNode),
185 attrMapAttr = attrMap[attr];
186 // IE9 sometimes reports getBoundingClientRect.bottom incorrectly for TD so also check offset*
187 doh.t(Math.round(textboxPos[attr]) == Math.round(validationPos[attr])
188 || (attrMapAttr && textboxNode[attrMapAttr] > 0 && textboxNode[attrMapAttr] == validationNode[attrMapAttr]),
189 "validationPos " + attr + " " + textboxPos[attr] + " vs " + validationPos[attr]);
190 doh.t(Math.round(textboxPos[attr]) == Math.round(comboboxPos[attr])
191 || (attrMapAttr && textboxNode[attrMapAttr] > 0 && textboxNode[attrMapAttr] == comboboxNode[attrMapAttr]),
192 "comboboxPos " + attr + " " + textboxPos[attr] + " vs " + comboboxPos[attr]);
193 doh.t(Math.round(textboxPos[attr]) == Math.round(selectPos[attr])
194 || (attrMapAttr && textboxNode[attrMapAttr] > 0 && textboxNode[attrMapAttr] == selectNode[attrMapAttr])
195 || (dojo.isIE <= 7 && (Math.round(textboxPos[attr]) - Math.round(selectPos[attr]) == 2)), // box-sizing issue
196 "selectPos " + attr + " " + textboxPos[attr] + " vs " + selectPos[attr]);
197 doh.t(Math.round(textboxPos[attr]) == Math.round(spinnerPos[attr])
198 || (attrMapAttr && textboxNode[attrMapAttr] > 0 && textboxNode[attrMapAttr] == spinnerNode[attrMapAttr]),
199 "spinnerPos " + attr + " " + textboxPos[attr] + " vs " + spinnerPos[attr]);
200 }catch(e){
201 throw e; // prevent consoles from including entire function text in output
202 }
203 };
204
205 var runTest = [
206 {
207 name: "x",
208 runTest: function(){ compareToTextBox("x"); }
209 },
210 {
211 name: "h",
212 runTest: function(){ compareToTextBox("h"); }
213 },
214 {
215 name: "w",
216 runTest: function(){ compareToTextBox("w"); }
217 }
218 ];
219
220 var createErrors = function(){
221 textbox._hasBeenBlurred = true;
222 textbox.set('value', "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz");
223 validation._hasBeenBlurred = true;
224 validation.set('displayedValue', "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz");
225 combobox._hasBeenBlurred = true;
226 combobox.set('displayedValue', "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz");
227 spinner._hasBeenBlurred = true;
228 spinner.set('displayedValue', "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz");
229 select._hasBeenBlurred = true;
230 select.set('value', "");
231 };
232
233 doh.register("create normal boxes", {
234 name: "setup",
235 timeout: 9000,
236 runTest: function(){
237 var d = new doh.Deferred();
238 /* create errors, then insert good values to exercise the widget rendering */
239 createErrors();
240 validation.set('value', 23);
241 spinner.set('value', 32);
242 combobox.onChange = function(v){ if(v == "KY"){ d.callback(true); combobox.onChange = function(){}; }};
243 combobox.set('value', "KY");
244 select.set('value', "noError");
245 return d;
246 }
247 });
248
249 doh.register("check normal sizes", runTest);
250
251 dojo.forEach([textbox, validation, combobox, select, spinner], function(widget){
252 var widgetName = widget.baseClass.replace(/^.* /, "");
253 doh.register("valid internal offsets", [
254 {
255 name: "textbox: " + widgetName,
256 timeout: 1000,
257 runTest: function(){
258 var paddedBoxPos = dojo.position(widget.containerNode || widget.focusNode.parentNode),
259 inputPos = dojo.position(dojo.query('.dijitSelectLabel', widget.domNode)[0] || widget.focusNode),
260 paddingLeft = Math.abs(inputPos.x - paddedBoxPos.x),
261 paddingRight = Math.abs(inputPos.w - paddedBoxPos.w) - paddingLeft,
262 paddingTop = Math.abs(inputPos.y - paddedBoxPos.y),
263 paddingBottom = Math.abs(inputPos.h - paddedBoxPos.h) - paddingTop,
264 pad = undefined;
265 if(dojo.hasClass(testtable, "padded")){
266 pad = 10;
267 }else if(dojo.hasClass(testtable, "unPadded")){
268 pad = 0;
269 }else{
270 return;
271 }
272 doh.t(Math.abs(paddingLeft-pad) <= 1, "left padding("+paddingLeft+") should be "+pad);
273 doh.t(Math.abs(paddingRight-pad) <= 1, "right padding("+paddingRight+") should be "+pad);
274 doh.t(Math.abs(paddingTop-pad) <= 1, "top padding("+paddingTop+") should be "+pad);
275 doh.t(Math.abs(paddingBottom-pad) <= 1, "bottom padding("+paddingBottom+") should be "+pad);
276 }
277 },
278 {
279 name: "padded box: " + widgetName,
280 timeout: 1000,
281 runTest: function(){
282 var domNodePos = dojo.position(widget.domNode),
283 contentNode = (widget.containerNode || widget.focusNode).parentNode,
284 paddedBoxPos = dojo.position(contentNode),
285 //paddedBoxPos = dojo.position(widget.containerNode || widget.focusNode.parentNode),
286 // getBorderExtents bug neccesitates use of currentStyle
287 borderV = ((widget.domNode.currentStyle && widget.domNode.currentStyle.borderTopWidth)
288 ? (parseInt(widget.domNode.currentStyle.borderTopWidth) + parseInt(widget.domNode.currentStyle.borderBottomWidth))
289 : dojo.getBorderExtents(widget.domNode).h)
290 || (widget.domNode.offsetHeight - widget.domNode.firstChild.offsetHeight),
291 borderH = ((widget.domNode.currentStyle && widget.domNode.currentStyle.borderLeftWidth)
292 ? (parseInt(widget.domNode.currentStyle.borderLeftWidth) + parseInt(widget.domNode.currentStyle.borderRightWidth))
293 : dojo.getBorderExtents(widget.domNode).h)
294 || (widget.domNode.offsetWidth - widget.domNode.firstChild.offsetWidth);
295 if(!borderV || !borderH){ // border is inside domNode
296 var be = dojo.getBorderExtents(contentNode);
297 paddedBoxPos.x += be.l;
298 paddedBoxPos.y += be.t;
299 paddedBoxPos.w -= be.w;
300 paddedBoxPos.h -= be.h;
301 borderV = be.h;
302 borderH = be.w;
303 }
304 var clientHeight = widget.domNode.offsetHeight - borderV,
305 clientWidth = widget.domNode.offsetWidth - borderH,
306 offset = Math.min(Math.abs(domNodePos.x + (borderH >> 1) - paddedBoxPos.x), Math.abs(domNodePos.x + domNodePos.w - (borderH >> 1) - paddedBoxPos.x - paddedBoxPos.w));
307 doh.t(Math.abs(clientHeight-paddedBoxPos.h) <= 1, "padded textbox height: " + clientHeight + " vs " + paddedBoxPos.h);
308 doh.t(offset <= 1, "padded textbox horizontally just left or right (" + offset + ") of domNode: domNode x/w/b = " + domNodePos.x+"/"+domNodePos.w+"/"+borderH + ", pad box x/w = " + paddedBoxPos.x+"/"+paddedBoxPos.w);
309 }
310 },
311 {
312 name: "button: " + widgetName,
313 timeout: 1000,
314 runTest: function(){
315 var buttonNode = dojo.query(".dijitArrowButton", widget.domNode)[0];
316 if(!buttonNode){ return; }
317 var paddedBoxNode = (widget.containerNode || widget.focusNode).parentNode;
318 while(buttonNode.parentNode != paddedBoxNode.parentNode){
319 buttonNode = buttonNode.parentNode;
320 }
321 var paddedBoxPos = dojo.position(paddedBoxNode),
322 buttonPos = dojo.position(buttonNode),
323 offset = Math.min(Math.abs(paddedBoxPos.x + paddedBoxPos.w - buttonPos.x), Math.abs(buttonPos.x + buttonPos.w - paddedBoxPos.x));
324 // IE 6 & quirks float bug(s) causes a known 3px margin between input field & validation icon
325 // Fix could be .dj_ie .dijitInputField { float:right; }
326 // But this breaks even more the tests, dojo.position() bug?
327 if(dojo.isIE < 7 || dojo.isQuirks)
328 doh.t(offset <= 4, "button node horizontally just left or right (" + offset + ") of padded input node: input x/w = " + paddedBoxPos.x+"/"+paddedBoxPos.w + ", button x/w = " + buttonPos.x+"/"+buttonPos.w);
329 else
330 doh.t(offset <= 1, "button node horizontally just left or right (" + offset + ") of padded input node: input x/w = " + paddedBoxPos.x+"/"+paddedBoxPos.w + ", button x/w = " + buttonPos.x+"/"+buttonPos.w);
331 }
332 }
333 ]);
334 });
335
336 doh.register("create errors", {
337 name: "setup",
338 timeout: 9000,
339 runTest: function(){
340 var d = new doh.Deferred();
341 createErrors();
342 textbox.onChange = function(v){ d.callback(true); textbox.onChange = function(){}; };
343 textbox.set('value', textbox.get('value')+' ');
344 return d;
345 }
346 });
347
348 doh.register("check error sizes", runTest);
349
350 doh.register("check button sizes", [
351 {
352 name: "ComboBox",
353 timeout: 1000,
354 runTest: function(){
355 var inputPos = dojo.position(combobox.focusNode.parentNode),
356 arrowPos = dojo.position(combobox._buttonNode);
357 doh.t(Math.abs(inputPos.h-arrowPos.h) <= 1, "ComboBox button height (" + arrowPos.h + ") is same as input height (" + inputPos.h + ")");
358 }
359 },
360 {
361 name: "Spinner",
362 timeout: 1000,
363 runTest: function(){
364 // use offsetHeight since the buttons could be truncated by overflow:hidden
365 var inputHeight = spinner.focusNode.parentNode.offsetHeight,
366 downArrowHeight = spinner.downArrowNode.offsetHeight,
367 upArrowHeight = spinner.upArrowNode.offsetHeight;
368 doh.t((inputHeight-downArrowHeight-upArrowHeight) <= 1, "Spinner button heights (" + upArrowHeight + "," + downArrowHeight + ") are equal to the input height (" + inputHeight + ")");
369 doh.t(Math.abs(upArrowHeight - downArrowHeight) <= 1, "Spinner UP button height (" + upArrowHeight + ") is equal to the DOWN button height (" + downArrowHeight + ")");
370 }
371 }
372 ]);
373
374 dojo.forEach([validation, combobox, spinner], function(widget){
375 var widgetName = widget.baseClass.replace(/^.* /, "");
376 doh.register("error internal offsets", [
377 {
378 name: "textbox: " + widgetName,
379 timeout: 1000,
380 runTest: function(){
381 var paddedBoxPos = dojo.position(widget.focusNode.parentNode),
382 inputPos = dojo.position(widget.focusNode),
383 paddingLeft = Math.abs(inputPos.x - paddedBoxPos.x),
384 paddingRight = Math.abs(inputPos.w - paddedBoxPos.w) - paddingLeft,
385 paddingTop = Math.abs(inputPos.y - paddedBoxPos.y),
386 paddingBottom = Math.abs(inputPos.h - paddedBoxPos.h) - paddingTop,
387 pad = undefined;
388 if(dojo.hasClass(testtable, "padded")){
389 pad = 10;
390 }else if(dojo.hasClass(testtable, "unPadded")){
391 pad = 0;
392 }else{
393 return;
394 }
395 doh.t(Math.abs(paddingLeft-pad) <= 1, "left padding("+paddingLeft+") should be "+pad);
396 doh.t(Math.abs(paddingRight-pad) <= 1, "right padding("+paddingRight+") should be "+pad);
397 doh.t(Math.abs(paddingTop-pad) <= 1, "top padding("+paddingTop+") should be "+pad);
398 doh.t(Math.abs(paddingBottom-pad) <= 1, "bottom padding("+paddingBottom+") should be "+pad);
399 }
400 },
401 {
402 name: "padded box: " + widgetName,
403 timeout: 1000,
404 runTest: function(){
405 var domNodePos = dojo.position(widget.domNode),
406 paddedBoxPos = dojo.position(widget.focusNode.parentNode),
407 clientHeight = widget.domNode.clientHeight,
408 clientWidth = widget.domNode.clientWidth,
409 border = (domNodePos.w - clientWidth) >> 1, // average border width
410 offset = Math.min(Math.abs(domNodePos.x + border - paddedBoxPos.x), Math.abs(domNodePos.x + domNodePos.w - border - paddedBoxPos.x - paddedBoxPos.w));
411 doh.t(Math.abs(clientHeight-paddedBoxPos.h) <= 1, "padded textbox height: " + clientHeight + " vs " + paddedBoxPos.h);
412 doh.t(offset <= 1, "padded textbox horizontally just left or right (" + offset + ") of domNode: domNode x/w/b = " + domNodePos.x+"/"+domNodePos.w+"/"+border + ", pad box x/w = " + paddedBoxPos.x+"/"+paddedBoxPos.w);
413 }
414 },
415 {
416 name: "validation node: " + widgetName,
417 timeout: 1000,
418 runTest: function(){
419 if(widget.state != "Error"){ return; }
420 var validationNode = dojo.query(".dijitValidationContainer", widget.domNode)[0],
421 validationPos = dojo.position(validationNode),
422 paddedBoxPos = dojo.position(widget.focusNode.parentNode),
423 offset = Math.min(Math.abs(paddedBoxPos.x + paddedBoxPos.w - validationPos.x), Math.abs(validationPos.x + validationPos.w - paddedBoxPos.x));
424
425 // IE 6 & quirks float bug(s) causes a known 3px margin between input field & validation icon
426 // Fix could be .dj_ie .dijitInputField { float:right; }
427 // But this breaks even more the tests, dojo.position() bug?
428 if(dojo.isIE < 7 || dojo.isQuirks)
429 doh.t(offset <= 4, "padded textbox horizontally just left or right (" + offset + ") of validation node: valiation node x/w = " + validationPos.x+"/"+validationPos.w + ", pad box x/w = " + paddedBoxPos.x+"/"+paddedBoxPos.w);
430 else
431 doh.t(offset <= 1, "padded textbox horizontally just left or right (" + offset + ") of validation node: valiation node x/w = " + validationPos.x+"/"+validationPos.w + ", pad box x/w = " + paddedBoxPos.x+"/"+paddedBoxPos.w);
432 }
433 },
434 {
435 name: "button: " + widgetName,
436 timeout: 1000,
437 runTest: function(){
438 if(widget.state != "Error" || widgetName == "dijitValidationTextBox" ||
439 widgetName == "dijitNumberTextBox" || widgetName == "dijitCurrencyTextBox"){ return; }
440 var validationNode = dojo.query(".dijitValidationContainer", widget.domNode)[0],
441 buttonNode = dojo.query(".dijitValidationContainer", widget.domNode)[0].previousSibling,
442 validationPos = dojo.position(validationNode),
443 buttonPos = dojo.position(buttonNode),
444 offset = Math.min(Math.abs(validationPos.x + validationPos.w - buttonPos.x), Math.abs(buttonPos.x + buttonPos.w - validationPos.x));
445 doh.t(offset <= 1, "button node horizontally just left or right (" + offset + ") of validation node: valiation node x/w = " + validationPos.x+"/"+validationPos.w + ", button x/w = " + buttonPos.x+"/"+buttonPos.w);
446 }
447 }
448 ]);
449 });
450
451 doh.run();
452 });
453 </script>
454 </head>
455 <body class="claro" role="main">
456
457 <h1 class="testTitle">dijit.form.TextBox size tests</h1>
458
459 <table class="padded" id="table" style="font-family:monospace;font-size:12pt;" role="presentation">
460 <tr>
461 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
462 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
463 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
464 </tr>
465 <tr>
466 <td class="layout">TextBox</td>
467 <td class="layout"><input id="textbox" data-dojo-type="dijit/form/TextBox" data-dojo-props='type:"text", value:"text", "aria-label":"textbox"'/></td>
468 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
469 </tr>
470 <tr>
471 <td class="layout">NumberTextBox</td>
472 <td class="layout"><input id="validation" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='type:"text", value:54, required:true, "aria-label":"NumberTextBox"'/></td>
473 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
474 </tr>
475 <tr>
476 <td class="layout">FilteringSelect</td>
477 <td class="layout"><select id="combobox" data-dojo-type="dijit/form/FilteringSelect" data-dojo-props='required:true, "aria-label":"FilteringSelect"'>
478 <option value="KY">Kentucky</option>
479 </select></td>
480 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
481 </tr>
482 <tr>
483 <td class="layout">Select</td>
484 <td class="layout">
485 <!-- width:0px prevents IE from resizing the table columns inappropriately -->
486 <select id="select" data-dojo-type="dijit/form/Select" style="width:0px;" data-dojo-props='required:true, "aria-label":"Select"'>
487 <option data-dojo-value="">Invalid</option>
488 <option data-dojo-value="noError">Some Label</option>
489 </select></td>
490 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
491 </tr>
492 <tr>
493 <td class="layout">NumberSpinner</td>
494 <td class="layout"><div id="spinner" data-dojo-type="dijit/form/NumberSpinner" data-dojo-props='type:"text", value:45, required:true, "aria-label":"numberSpinner"'></div></td>
495 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
496 </tr>
497 <tr>
498 <td class="layout">INPUT type=file</td>
499 <td class="layout"><input id="file" data-dojo-type="dijit/form/TextBox" data-dojo-props='type:"file", "aria-label":"textboxFile" '/></td>
500 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
501 </tr>
502 <tr>
503 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
504 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
505 <td style="font-size:1px;overflow:hidden;">&nbsp;</td>
506 </tr>
507 </table><br>
508 <script type="text/javascript">
509 testtable = dojo.byId('table');
510
511 function fontFamilyOnChange(fontFamily){
512 testtable.style.fontFamily = fontFamily;
513 if(dojo.isIE){
514 dojo.query('[widgetId]', document.body).forEach(function(node){
515 node.style.fontFamily = fontFamily;
516 dojo.query('*', node).forEach(function(node){
517 node.style.fontFamily = fontFamily;
518 });
519 });
520 }
521 }
522
523 function directionOnChange(direction){
524 dojo.query('[widgetId]', testtable).forEach(function(node){
525 if(dojo.isIE == 7){ // IE layout bugs
526 dojo.query('INPUT', node).forEach(function(node){
527 node.className = node.className;
528 });
529 }
530 node.style.direction = direction;
531 node.parentNode.style.direction = direction;
532 dojo.forEach(node.className.split(' '), function(cls){
533 if(cls.indexOf('Rtl') > 0){
534 dojo.removeClass(node, cls);
535 }
536 });
537 if(direction == "rtl"){
538 dojo.forEach(node.className.split(' '), function(cls){
539 if(cls.indexOf('Box') > 0){
540 cls = cls.substr(0, cls.indexOf('Box')+3) + "Rtl" + cls.substr(cls.indexOf('Box')+3);
541 }else{
542 cls = cls + "Rtl";
543 }
544 dojo.addClass(node, cls);
545 });
546 }
547 });
548 }
549
550 function themeOnChange(theme){
551 if(theme == "a11y"){
552 theme="dj_a11y";
553 }
554 dojo.body().className = theme + ((this.isRealA11y && theme != "dj_a11y") ? " dj_a11y" : "");
555 }
556
557
558 function sizeOnChange(size){
559 testtable.style.fontSize = size;
560 dojo.query('[widgetId]', testtable).forEach(function(node){
561 if(dojo.isIE == 7){ // IE layout bugs
562 dojo.query('INPUT', node).forEach(function(node){
563 node.className = node.className;
564 });
565 }
566 });
567 }
568
569 function paddingOnChange(padding){
570 testtable.className = padding;
571 dojo.query('[widgetId]', testtable).forEach(function(node){
572 if(dojo.isIE == 7){ // IE layout bugs
573 dojo.query('INPUT', node).forEach(function(node){
574 node.className = node.className;
575 });
576 }
577 });
578 }
579 </script>
580 <table style="background-color:cyan;" border="1" role="presentation">
581 <tr><td class="layout" style="text-align:right;">Font family:
582 <select id="fontFamily" data-dojo-type="dijit/form/ComboBox" data-dojo-props='style:{fontSize:"14pt"}, value:"", onChange:fontFamilyOnChange, "aria-label":"fontFamily"'>
583 <option selected>monospace</option>
584 <option>Helvetica</option>
585 <option>Times</option>
586 <option>Verdana</option>
587 </select></td></tr>
588 <tr><td class="layout" style="text-align:right;">Font size:
589 <select id="fontSize" data-dojo-type="dijit/form/ComboBox" data-dojo-props='style:{fontSize:"14pt"}, value:"", onChange:sizeOnChange, "aria-label":"fontSize"'>
590 <option>small</option>
591 <option selected>12pt</option>
592 <option>xx-large</option>
593 <option>8pt</option>
594 <option>21px</option>
595 <option>1cm</option>
596 <option>1em</option>
597 <option>200%</option>
598 </select></td></tr>
599 <tr><td class="layout" style="text-align:right;">Padding:
600 <select id="padding" data-dojo-type="dijit/form/Select" data-dojo-props='style:{width:"0px", fontSize:"14pt"}, value:"padded", onChange:paddingOnChange, "aria-label":"padding"'>
601 <option value="default">default</option>
602 <option value="padded">padded</option>
603 <option value="unPadded">unPadded</option>
604 </select></td></tr>
605 <tr><td class="layout" style="text-align:right;">Direction:
606 <span id="direction" data-dojo-type="dijit/form/Select" data-dojo-props='style:{width:"0px", fontSize:"14pt"}, value:"ltr", onChange:directionOnChange, "aria-label":"direction"'>
607 <span data-dojo-value="ltr">left-to-right</span>
608 <span data-dojo-value="rtl">right-to-left</span>
609 </span></td></tr>
610 <tr><td class="layout" style="text-align:right;">Theme:
611 <select id="theme" data-dojo-type="dijit/form/Select" data-dojo-props='style:{width:"0px", fontSize:"14pt"}, value:"claro", onChange:themeOnChange, "aria-label":"theme"'>
612 <option data-dojo-value="tundra">tundra</option>
613 <option data-dojo-value="soria">soria</option>
614 <option data-dojo-value="nihilo">nihilo</option>
615 <option data-dojo-value="claro">claro</option>
616 <option data-dojo-value="a11y">a11y</option>
617 </select></td></tr>
618 </table>
619 <button data-dojo-type="dijit/form/Button" data-dojo-props='onClick:function(){ doh.run(); }'>Run tests</button>
620 </body>
621 </html>