| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Dojo Spinner Widget Test</title> |
| 6 |
|
| 7 |
<style type="text/css"> |
| 8 |
@import "../../themes/claro/document.css"; |
| 9 |
@import "../css/dijitTests.css"; |
| 10 |
@import "../../../util/doh/robot/robot.css"; |
| 11 |
|
| 12 |
body .bigFont { |
| 13 |
font-size: larger; /* help test widget sizing */ |
| 14 |
} |
| 15 |
|
| 16 |
</style> |
| 17 |
|
| 18 |
|
| 19 |
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/> |
| 20 |
|
| 21 |
|
| 22 |
<script type="text/javascript" src="../../../dojo/dojo.js" |
| 23 |
data-dojo-config="isDebug: true, parseOnLoad: true"></script> |
| 24 |
|
| 25 |
|
| 26 |
<script type="text/javascript" src="../_testCommon.js"></script> |
| 27 |
|
| 28 |
<script type="text/javascript"> |
| 29 |
dojo.require("dijit.dijit"); // optimize: load dijit layer |
| 30 |
dojo.require("dijit.form.NumberSpinner"); |
| 31 |
dojo.require("dojo.parser"); // scan page for widgets |
| 32 |
</script> |
| 33 |
|
| 34 |
</head> |
| 35 |
|
| 36 |
<body class="claro" role="main"> |
| 37 |
<h1 class="testTitle">Dijit Spinner Test</h1> |
| 38 |
Try typing values, and use the up/down arrow keys and/or the arrow push |
| 39 |
buttons to spin |
| 40 |
<br> |
| 41 |
<form id="form1" action="" name="example" method="post"> |
| 42 |
<h1>number spinner</h1> |
| 43 |
<br> |
| 44 |
initial value=900, no delta specified, no min specified, max=1550, onChange captured, big font<br> |
| 45 |
<label for="integerspinner1">Spinbox #1: </label><br> |
| 46 |
<input id="integerspinner1" data-dojo-type="dijit/form/NumberSpinner" |
| 47 |
data-dojo-props='onChange:function(val){ dojo.byId("oc1").value = val; }, |
| 48 |
value:900, |
| 49 |
"class":"bigFont", |
| 50 |
constraints:{max:1550,places:0}, |
| 51 |
name:"integerspinner1" |
| 52 |
'/> |
| 53 |
<label for="oc1">onChange:</label><input id="oc1" disabled value="not fired yet!" autocomplete="off"/> |
| 54 |
<input type="button" id="sv1_1" value="Set value to 400" onClick="dijit.byId('integerspinner1').set('value',400)" tabIndex="-1"/> |
| 55 |
<input type="button" id="sv1_2" value="Set value to null" onClick="dijit.byId('integerspinner1').set('value',null)" tabIndex="-1"/> |
| 56 |
<input type="button" id="sv1_3" value="Set required to false" onClick="dijit.byId('integerspinner1').set('required',false)" tabIndex="-1"/> |
| 57 |
<input type="button" id="sv1_4" value="Set required to true" onClick="dijit.byId('integerspinner1').set('required',true)" tabIndex="-1"/> |
| 58 |
<br> |
| 59 |
<br> |
| 60 |
initial value=1000, delta=10, min=9 max=1550<br> |
| 61 |
<label for="integerspinner2">Spinbox with custom styling (width=50%, 200% Courier font): </label> |
| 62 |
<input id="integerspinner2" data-dojo-type="dijit/form/NumberSpinner" |
| 63 |
data-dojo-props='style:{fontSize:"200%", fontFamily:"Courier", border:"1px solid blue", width:"50%"}, |
| 64 |
value:1000, |
| 65 |
smallDelta:10, |
| 66 |
largeDelta:100, |
| 67 |
constraints:{min:9,max:1550,places:0}, |
| 68 |
style:{ textAlign: "right" }, |
| 69 |
name:"integerspinner2" |
| 70 |
'/> |
| 71 |
<br> |
| 72 |
<br> |
| 73 |
<label for="integertextbox3">Spinner line break test: </label>initial value not specified, delta not specified, min not specified, max not specified, signed not specified, separator not specified<br> |
| 74 |
[verify no line break just after this text] |
| 75 |
<input id="integertextbox3" data-dojo-type="dijit/form/NumberSpinner" data-dojo-props='name:"integertextbox3" '/> |
| 76 |
[verify no line break just before this text] |
| 77 |
<br> |
| 78 |
<br> |
| 79 |
Move the cursor left and right within the input field to see the effect on the spinner. |
| 80 |
<br> |
| 81 |
initial value=+1.0, smalldelta=0.1, largedelta=1.0, min=-10.9, max=155, places=1, maxLength=20, exponent=false<br> |
| 82 |
<label for="realspinner1">Real Number Spinbox #1: </label><br> |
| 83 |
<input id="realspinner1" data-dojo-type="dijit/form/NumberSpinner" |
| 84 |
data-dojo-props='value:1.0, |
| 85 |
smallDelta:0.1, |
| 86 |
largeDelta:1.0, |
| 87 |
constraints:{min:-10.9,max:155,places:1,round:true,exponent:false}, |
| 88 |
maxLength:"20", |
| 89 |
name:"realspinner1" |
| 90 |
'/> |
| 91 |
<br> |
| 92 |
|
| 93 |
<p> |
| 94 |
<label for="spinnerMinOnly">Spinner with no maximum, 1 decimal place: </label><br> |
| 95 |
<input id="spinnerMinOnly" data-dojo-type="dijit/form/NumberSpinner" |
| 96 |
data-dojo-props='value:1.0, |
| 97 |
smallDelta:0.1, |
| 98 |
largeDelta:1.0, |
| 99 |
constraints:{min:-10.9,places:1,round:false}, |
| 100 |
maxLength:"20", |
| 101 |
name:"spinnerMinOnly" |
| 102 |
'/> |
| 103 |
<input type="button" onclick="dijit.byId('spinnerMinOnly').set('readOnly',false);" value="Remove readOnly"/> |
| 104 |
<input type="button" onclick="dijit.byId('spinnerMinOnly').set('readOnly',true);" value="Set readOnly"/> |
| 105 |
<input type="button" onclick="dijit.byId('spinnerMinOnly').set('disabled',false);" value="Remove disabled"/> |
| 106 |
<input type="button" onclick="dijit.byId('spinnerMinOnly').set('disabled',true);" value="Set disabled"/> |
| 107 |
</p> |
| 108 |
<p> |
| 109 |
<script type="text/javascript"> |
| 110 |
// so robot can get to it easily |
| 111 |
document.displayData=function(){ |
| 112 |
var f = document.getElementById("form1"); |
| 113 |
var s = ""; |
| 114 |
for(var i = 0; i < f.elements.length; i++){ |
| 115 |
var elem = f.elements[i]; |
| 116 |
if(elem.nodeName.toLowerCase() == "button" || elem.type=="submit" || elem.type=="button") { continue; } |
| 117 |
s += elem.name + ": " + elem.value + "\n"; |
| 118 |
} |
| 119 |
return s; |
| 120 |
} |
| 121 |
</script> |
| 122 |
|
| 123 |
<div> |
| 124 |
<button name="button" onclick="alert(document.displayData()); return false;">view data</button> |
| 125 |
<input type="submit" name="submit" /> |
| 126 |
</div> |
| 127 |
</form> |
| 128 |
</body> |
| 129 |
</html> |