| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Validation Message Test</title> |
| 6 |
|
| 7 |
<style> |
| 8 |
@import "../../../themes/claro/document.css"; |
| 9 |
@import "../../css/dijitTests.css"; |
| 10 |
@import "../../../../util/doh/robot/robot.css"; |
| 11 |
</style> |
| 12 |
<link id="themeStyles" rel="stylesheet" href="../../../themes/dijit.css"/> |
| 13 |
|
| 14 |
|
| 15 |
<script type="text/javascript" src="../../../../dojo/dojo.js" |
| 16 |
data-dojo-config="isDebug: true, locale: 'en-us'"></script> |
| 17 |
|
| 18 |
<script type="text/javascript"> |
| 19 |
dojo.require("dojo.parser"); |
| 20 |
|
| 21 |
dojo.require("dijit.form.NumberTextBox"); |
| 22 |
dojo.require("dijit.Tooltip"); |
| 23 |
dojo.require("dijit.robot"); |
| 24 |
|
| 25 |
dojo.ready(function(){ |
| 26 |
|
| 27 |
// track tooltip currently being displayed (if any) |
| 28 |
var tooltip; |
| 29 |
dojo.connect(dijit.Tooltip, "show", function(msg){ tooltip = msg; }); |
| 30 |
dojo.connect(dijit.Tooltip, "hide", function(msg){ tooltip = ""; }); |
| 31 |
|
| 32 |
function testOn(evt, widget, deferred, callback, delay){ |
| 33 |
var handler = widget.connect(widget.focusNode, "on"+evt, |
| 34 |
function(){ |
| 35 |
widget.disconnect(handler); |
| 36 |
setTimeout(deferred.getTestCallback(callback), delay||33); |
| 37 |
}); |
| 38 |
} |
| 39 |
|
| 40 |
doh.register("parse", function parse(){ |
| 41 |
dojo.parser.parse(); |
| 42 |
}); |
| 43 |
|
| 44 |
dojo.forEach([false, true], function(rangeBound){ |
| 45 |
dojo.forEach([false, true], function(required){ |
| 46 |
dojo.forEach(["", "p"], function(promptMessage){ |
| 47 |
dojo.forEach(["", "i"], function(invalidMessage){ |
| 48 |
dojo.forEach(["", "m"], function(missingMessage){ |
| 49 |
var name = "t" + (rangeBound?1:0) + (required?1:0) + (promptMessage?1:0) + (invalidMessage?1:0) + (missingMessage?1:0); |
| 50 |
var textbox; |
| 51 |
|
| 52 |
doh.register(name, [ |
| 53 |
{ |
| 54 |
name: name + " first focus, empty value", |
| 55 |
timeout: 5000, |
| 56 |
setUp:function(){ |
| 57 |
textbox = dijit.byId(name); |
| 58 |
textbox.focusNode.scrollIntoView(); |
| 59 |
}, |
| 60 |
runTest: function(){ |
| 61 |
var d = new doh.Deferred(); |
| 62 |
testOn('mouseup', textbox, d, function(){ |
| 63 |
doh.is(!required, textbox.isValid(false), "isValid"); |
| 64 |
doh.is(required ? "Incomplete" : "", textbox.state, "state"); |
| 65 |
doh.is(promptMessage, tooltip, "tooltip"); |
| 66 |
}); |
| 67 |
doh.robot.mouseMoveAt(textbox.focusNode, 0, 1); |
| 68 |
doh.robot.mouseClick({left: true}, 0); |
| 69 |
return d; |
| 70 |
} |
| 71 |
}, |
| 72 |
{ |
| 73 |
name: name + " first valid character", |
| 74 |
timeout: 2000, |
| 75 |
runTest: function(){ |
| 76 |
var d = new doh.Deferred(); |
| 77 |
testOn('input', textbox, d, function(){ |
| 78 |
doh.is(!rangeBound, textbox.isValid(true), "isValid"); |
| 79 |
doh.is(rangeBound ? "Incomplete" : "", textbox.state, "state"); |
| 80 |
doh.is(rangeBound? promptMessage : "", tooltip, "tooltip"); |
| 81 |
}); |
| 82 |
doh.robot.typeKeys("1", 0, 0); |
| 83 |
return d; |
| 84 |
} |
| 85 |
}, |
| 86 |
{ |
| 87 |
name: name + " second valid character", |
| 88 |
timeout: 2000, |
| 89 |
runTest: function(){ |
| 90 |
var d = new doh.Deferred(); |
| 91 |
testOn('input', textbox, d, function(){ |
| 92 |
doh.t(textbox.isValid(true), "isValid"); |
| 93 |
doh.is("", textbox.state, "state"); |
| 94 |
doh.is("", tooltip, "tooltip"); |
| 95 |
}); |
| 96 |
doh.robot.typeKeys("2", 0, 0); |
| 97 |
return d; |
| 98 |
} |
| 99 |
}, |
| 100 |
{ |
| 101 |
name: name + " first invalid character", |
| 102 |
timeout: 2000, |
| 103 |
runTest: function(){ |
| 104 |
var d = new doh.Deferred(); |
| 105 |
testOn('input', textbox, d, function(){ |
| 106 |
doh.f(textbox.isValid(true), "isValid"); |
| 107 |
doh.is("Error", textbox.state, "state"); |
| 108 |
doh.is(invalidMessage||promptMessage, tooltip, "tooltip"); |
| 109 |
}); |
| 110 |
doh.robot.typeKeys("a", 0, 0); |
| 111 |
return d; |
| 112 |
} |
| 113 |
}, |
| 114 |
{ |
| 115 |
name: name + " delete invalid character", |
| 116 |
timeout: 2000, |
| 117 |
runTest: function(){ |
| 118 |
var d = new doh.Deferred(); |
| 119 |
testOn('input', textbox, d, function(){ |
| 120 |
doh.t(textbox.isValid(true), "isValid"); |
| 121 |
doh.is("", textbox.state, "state"); |
| 122 |
doh.is("", tooltip, "tooltip"); |
| 123 |
}); |
| 124 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 125 |
return d; |
| 126 |
} |
| 127 |
}, |
| 128 |
{ |
| 129 |
name: name + " period", |
| 130 |
timeout: 2000, |
| 131 |
runTest: function(){ |
| 132 |
var d = new doh.Deferred(); |
| 133 |
testOn('input', textbox, d, function(){ |
| 134 |
// number.parse("12.", {fractional:[true,false], pattern:"#.#####"}) is valid |
| 135 |
doh.t(textbox.isValid(true), "isValid"); |
| 136 |
doh.is("", textbox.state, "state"); |
| 137 |
doh.is("", tooltip, "tooltip"); |
| 138 |
}); |
| 139 |
doh.robot.typeKeys(".", 0, 0); |
| 140 |
return d; |
| 141 |
} |
| 142 |
}, |
| 143 |
{ |
| 144 |
name: name + " invalid pre-fractional character", |
| 145 |
timeout: 2000, |
| 146 |
runTest: function(){ |
| 147 |
var d = new doh.Deferred(); |
| 148 |
testOn('input', textbox, d, function(){ |
| 149 |
doh.f(textbox.isValid(true), "isValid"); |
| 150 |
doh.is("Error", textbox.state, "state"); |
| 151 |
doh.is(invalidMessage||promptMessage, tooltip, "tooltip"); |
| 152 |
}); |
| 153 |
doh.robot.typeKeys("a", 0, 0); |
| 154 |
return d; |
| 155 |
} |
| 156 |
}, |
| 157 |
{ |
| 158 |
name: name + " delete invalid pre-fractional character", |
| 159 |
timeout: 2000, |
| 160 |
runTest: function(){ |
| 161 |
var d = new doh.Deferred(); |
| 162 |
testOn('input', textbox, d, function(){ |
| 163 |
doh.t(textbox.isValid(true), "isValid"); |
| 164 |
doh.is("", textbox.state, "state"); |
| 165 |
doh.is("", tooltip, "tooltip"); |
| 166 |
}); |
| 167 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 168 |
return d; |
| 169 |
} |
| 170 |
}, |
| 171 |
{ |
| 172 |
name: name + " valid fractional digit", |
| 173 |
timeout: 2000, |
| 174 |
runTest: function(){ |
| 175 |
var d = new doh.Deferred(); |
| 176 |
testOn('input', textbox, d, function(){ |
| 177 |
doh.t(textbox.isValid(true), "isValid"); |
| 178 |
doh.is("", textbox.state, "state"); |
| 179 |
doh.is("", tooltip, "tooltip"); |
| 180 |
}); |
| 181 |
doh.robot.typeKeys("1", 0, 0); |
| 182 |
return d; |
| 183 |
} |
| 184 |
}, |
| 185 |
{ |
| 186 |
name: name + " invalid fractional character", |
| 187 |
timeout: 2000, |
| 188 |
runTest: function(){ |
| 189 |
var d = new doh.Deferred(); |
| 190 |
testOn('input', textbox, d, function(){ |
| 191 |
doh.f(textbox.isValid(true), "isValid"); |
| 192 |
doh.is("Error", textbox.state, "state"); |
| 193 |
doh.is(invalidMessage||promptMessage, tooltip, "tooltip"); |
| 194 |
}); |
| 195 |
doh.robot.typeKeys("a", 0, 0); |
| 196 |
return d; |
| 197 |
} |
| 198 |
}, |
| 199 |
{ |
| 200 |
name: name + " delete invalid fractional character", |
| 201 |
timeout: 2000, |
| 202 |
runTest: function(){ |
| 203 |
var d = new doh.Deferred(); |
| 204 |
testOn('input', textbox, d, function(){ |
| 205 |
doh.t(textbox.isValid(true), "isValid"); |
| 206 |
doh.is("", textbox.state, "state"); |
| 207 |
doh.is("", tooltip, "tooltip"); |
| 208 |
}); |
| 209 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 210 |
return d; |
| 211 |
} |
| 212 |
}, |
| 213 |
{ |
| 214 |
name: name + " delete valid fractional digit", |
| 215 |
timeout: 2000, |
| 216 |
runTest: function(){ |
| 217 |
var d = new doh.Deferred(); |
| 218 |
testOn('input', textbox, d, function(){ |
| 219 |
doh.t(textbox.isValid(true), "isValid"); |
| 220 |
doh.is("", textbox.state, "state"); |
| 221 |
doh.is("", tooltip, "tooltip"); |
| 222 |
}); |
| 223 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 224 |
return d; |
| 225 |
} |
| 226 |
}, |
| 227 |
{ |
| 228 |
name: name + " delete period", |
| 229 |
timeout: 2000, |
| 230 |
runTest: function(){ |
| 231 |
var d = new doh.Deferred(); |
| 232 |
testOn('input', textbox, d, function(){ |
| 233 |
doh.t(textbox.isValid(true), "isValid"); |
| 234 |
doh.is("", textbox.state, "state"); |
| 235 |
doh.is("", tooltip, "tooltip"); |
| 236 |
}); |
| 237 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 238 |
return d; |
| 239 |
} |
| 240 |
}, |
| 241 |
{ |
| 242 |
name: name + " delete right-most valid character", |
| 243 |
timeout: 2000, |
| 244 |
runTest: function(){ |
| 245 |
var d = new doh.Deferred(); |
| 246 |
testOn('input', textbox, d, function(){ |
| 247 |
doh.is(!rangeBound, textbox.isValid(true), "isValid"); |
| 248 |
doh.is(rangeBound ? "Incomplete" : "", textbox.state, "state"); |
| 249 |
doh.is(rangeBound? promptMessage : "", tooltip, "tooltip"); |
| 250 |
}); |
| 251 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 252 |
return d; |
| 253 |
} |
| 254 |
}, |
| 255 |
{ |
| 256 |
name: name + " delete remaining valid character", |
| 257 |
timeout: 2000, |
| 258 |
runTest: function(){ |
| 259 |
var d = new doh.Deferred(); |
| 260 |
testOn('input', textbox, d, function(){ |
| 261 |
doh.is(!required, textbox.isValid(false), "isValid"); |
| 262 |
doh.is(required ? "Incomplete" : "", textbox.state, "state"); |
| 263 |
doh.is(promptMessage, tooltip, "tooltip"); |
| 264 |
}); |
| 265 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 266 |
return d; |
| 267 |
} |
| 268 |
}, |
| 269 |
{ |
| 270 |
name: name + " tab from empty", |
| 271 |
timeout: 2000, |
| 272 |
runTest: function(){ |
| 273 |
var d = new doh.Deferred(); |
| 274 |
testOn('blur', textbox, d, function(){ |
| 275 |
doh.is(!required, textbox.isValid(false), "isValid"); |
| 276 |
doh.is(required ? "Error" : "", textbox.state, "state"); |
| 277 |
doh.is("", tooltip, "no tooltip"); |
| 278 |
doh.is(required? (missingMessage||invalidMessage||promptMessage) : promptMessage, textbox.message, "message"); |
| 279 |
}); |
| 280 |
doh.robot.keyPress(dojo.keys.TAB, 0); |
| 281 |
return d; |
| 282 |
} |
| 283 |
}, |
| 284 |
{ |
| 285 |
name: name + " tab back to empty", |
| 286 |
timeout: 2000, |
| 287 |
runTest: function(){ |
| 288 |
var d = new doh.Deferred(); |
| 289 |
testOn('focus', textbox, d, function(){ |
| 290 |
doh.is(!required, textbox.isValid(false), "isValid"); |
| 291 |
doh.is(required ? "Error" : "", textbox.state, "state"); |
| 292 |
doh.is(required? (missingMessage||invalidMessage||promptMessage) : promptMessage, tooltip, "tooltip"); |
| 293 |
}); |
| 294 |
doh.robot.keyPress(dojo.keys.TAB, 0, { shift:true }); |
| 295 |
return d; |
| 296 |
} |
| 297 |
}, |
| 298 |
{ |
| 299 |
name: name + " first valid character after refocus", |
| 300 |
timeout: 2000, |
| 301 |
runTest: function(){ |
| 302 |
var d = new doh.Deferred(); |
| 303 |
testOn('input', textbox, d, function(){ |
| 304 |
doh.is(!rangeBound, textbox.isValid(false), "isValid"); |
| 305 |
doh.is(rangeBound ? "Incomplete" : "", textbox.state, "state"); |
| 306 |
doh.is(rangeBound? promptMessage : "", tooltip, "tooltip"); |
| 307 |
}); |
| 308 |
doh.robot.typeKeys("1", 0, 0); |
| 309 |
return d; |
| 310 |
} |
| 311 |
}, |
| 312 |
{ |
| 313 |
name: name + " 2nd valid character after refocus", |
| 314 |
timeout: 2000, |
| 315 |
runTest: function(){ |
| 316 |
var d = new doh.Deferred(); |
| 317 |
testOn('input', textbox, d, function(){ |
| 318 |
doh.is("", textbox.state, "state"); |
| 319 |
doh.is("", tooltip, "tooltip"); |
| 320 |
}); |
| 321 |
doh.robot.typeKeys("2", 0, 0); |
| 322 |
return d; |
| 323 |
} |
| 324 |
}, |
| 325 |
{ |
| 326 |
name: name + " out of range after refocus", |
| 327 |
timeout: 2000, |
| 328 |
runTest: function(){ |
| 329 |
var d = new doh.Deferred(); |
| 330 |
testOn('input', textbox, d, function(){ |
| 331 |
doh.is(!rangeBound, textbox.isValid(false), "isValid"); |
| 332 |
doh.is(rangeBound ? "Error" : "", textbox.state, "state"); |
| 333 |
doh.is(rangeBound? textbox.rangeMessage : "", tooltip, "tooltip"); |
| 334 |
}); |
| 335 |
doh.robot.typeKeys("3", 0, 0); |
| 336 |
return d; |
| 337 |
} |
| 338 |
}, |
| 339 |
{ |
| 340 |
name: name + " tab from out of range", |
| 341 |
timeout: 2000, |
| 342 |
runTest: function(){ |
| 343 |
var d = new doh.Deferred(); |
| 344 |
testOn('blur', textbox, d, function(){ |
| 345 |
doh.is(!rangeBound, textbox.isValid(false), "isValid"); |
| 346 |
doh.is(rangeBound ? "Error" : "", textbox.state, "state"); |
| 347 |
doh.is("", tooltip, "no tooltip"); |
| 348 |
doh.is(rangeBound? textbox.rangeMessage : "", textbox.message, "message"); |
| 349 |
}); |
| 350 |
doh.robot.keyPress(dojo.keys.TAB, 0); |
| 351 |
return d; |
| 352 |
} |
| 353 |
}, |
| 354 |
{ |
| 355 |
name: name + " tab back to out of range", |
| 356 |
timeout: 2000, |
| 357 |
runTest: function(){ |
| 358 |
var d = new doh.Deferred(); |
| 359 |
testOn('focus', textbox, d, function(){ |
| 360 |
doh.is(!rangeBound, textbox.isValid(false), "isValid"); |
| 361 |
doh.is(rangeBound ? "Error" : "", textbox.state, "state"); |
| 362 |
doh.is(rangeBound? textbox.rangeMessage : "", tooltip, "tooltip"); |
| 363 |
}); |
| 364 |
doh.robot.keyPress(dojo.keys.TAB, 0, { shift:true }); |
| 365 |
return d; |
| 366 |
} |
| 367 |
}, |
| 368 |
{ |
| 369 |
name: name + " position input caret to end", |
| 370 |
timeout: 2000, |
| 371 |
runTest: function(){ |
| 372 |
var d = new doh.Deferred(); |
| 373 |
testOn('keyup', textbox, d, function(){ |
| 374 |
doh.is(!rangeBound, textbox.isValid(true), "isValid"); |
| 375 |
doh.is(rangeBound ? "Error" : "", textbox.state, "state"); |
| 376 |
doh.is(rangeBound? textbox.rangeMessage : "", tooltip, "tooltip"); |
| 377 |
}); |
| 378 |
if(dojo.isMac){ |
| 379 |
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 0, {meta:true}); |
| 380 |
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 0); // trigger keyup |
| 381 |
}else{ |
| 382 |
doh.robot.keyPress(dojo.keys.END, 0); |
| 383 |
} |
| 384 |
return d; |
| 385 |
} |
| 386 |
}, |
| 387 |
{ |
| 388 |
name: name + " delete out of range character", |
| 389 |
timeout: 2000, |
| 390 |
runTest: function(){ |
| 391 |
var d = new doh.Deferred(); |
| 392 |
testOn('input', textbox, d, function(){ |
| 393 |
doh.t(textbox.isValid(true), "isValid"); |
| 394 |
doh.is("", textbox.state, "state"); |
| 395 |
doh.is("", tooltip, "tooltip"); |
| 396 |
|
| 397 |
}); |
| 398 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 399 |
return d; |
| 400 |
} |
| 401 |
}, |
| 402 |
{ |
| 403 |
name: name + " period after refocus", |
| 404 |
timeout: 2000, |
| 405 |
runTest: function(){ |
| 406 |
var d = new doh.Deferred(); |
| 407 |
testOn('input', textbox, d, function(){ |
| 408 |
doh.t(textbox.isValid(true), "isValid"); |
| 409 |
doh.is("", textbox.state, "state"); |
| 410 |
doh.is("", tooltip, "tooltip"); |
| 411 |
}); |
| 412 |
doh.robot.typeKeys(".", 0, 0); |
| 413 |
return d; |
| 414 |
} |
| 415 |
}, |
| 416 |
{ |
| 417 |
name: name + " invalid pre-fractional character after refocus", |
| 418 |
timeout: 2000, |
| 419 |
runTest: function(){ |
| 420 |
var d = new doh.Deferred(); |
| 421 |
testOn('input', textbox, d, function(){ |
| 422 |
doh.f(textbox.isValid(true), "isValid"); |
| 423 |
doh.is("Error", textbox.state, "state"); |
| 424 |
doh.is(invalidMessage||promptMessage, tooltip, "tooltip"); |
| 425 |
}); |
| 426 |
doh.robot.typeKeys("a", 0, 0); |
| 427 |
return d; |
| 428 |
} |
| 429 |
}, |
| 430 |
{ |
| 431 |
name: name + " delete invalid pre-fractional character after refocus", |
| 432 |
timeout: 2000, |
| 433 |
runTest: function(){ |
| 434 |
var d = new doh.Deferred(); |
| 435 |
testOn('input', textbox, d, function(){ |
| 436 |
doh.t(textbox.isValid(true), "isValid"); |
| 437 |
doh.is("", textbox.state, "state"); |
| 438 |
doh.is("", tooltip, "tooltip"); |
| 439 |
}); |
| 440 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 441 |
return d; |
| 442 |
} |
| 443 |
}, |
| 444 |
{ |
| 445 |
name: name + " valid fractional digit after refocus", |
| 446 |
timeout: 2000, |
| 447 |
runTest: function(){ |
| 448 |
var d = new doh.Deferred(); |
| 449 |
testOn('input', textbox, d, function(){ |
| 450 |
doh.t(textbox.isValid(true), "isValid"); |
| 451 |
doh.is("", textbox.state, "state"); |
| 452 |
doh.is("", tooltip, "tooltip"); |
| 453 |
}); |
| 454 |
doh.robot.typeKeys("1", 0, 0); |
| 455 |
return d; |
| 456 |
} |
| 457 |
}, |
| 458 |
{ |
| 459 |
name: name + " invalid fractional character after refocus", |
| 460 |
timeout: 2000, |
| 461 |
runTest: function(){ |
| 462 |
var d = new doh.Deferred(); |
| 463 |
testOn('input', textbox, d, function(){ |
| 464 |
doh.f(textbox.isValid(true), "isValid"); |
| 465 |
doh.is("Error", textbox.state, "state"); |
| 466 |
doh.is(invalidMessage||promptMessage, tooltip, "tooltip"); |
| 467 |
}); |
| 468 |
doh.robot.typeKeys("a", 0, 0); |
| 469 |
return d; |
| 470 |
} |
| 471 |
}, |
| 472 |
{ |
| 473 |
name: name + " delete invalid fractional character after refocus", |
| 474 |
timeout: 2000, |
| 475 |
runTest: function(){ |
| 476 |
var d = new doh.Deferred(); |
| 477 |
testOn('input', textbox, d, function(){ |
| 478 |
doh.t(textbox.isValid(true), "isValid"); |
| 479 |
doh.is("", textbox.state, "state"); |
| 480 |
doh.is("", tooltip, "tooltip"); |
| 481 |
}); |
| 482 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 483 |
return d; |
| 484 |
} |
| 485 |
}, |
| 486 |
{ |
| 487 |
name: name + " delete valid fractional digit after refocus", |
| 488 |
timeout: 2000, |
| 489 |
runTest: function(){ |
| 490 |
var d = new doh.Deferred(); |
| 491 |
testOn('input', textbox, d, function(){ |
| 492 |
doh.t(textbox.isValid(true), "isValid"); |
| 493 |
doh.is("", textbox.state, "state"); |
| 494 |
doh.is("", tooltip, "tooltip"); |
| 495 |
}); |
| 496 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 497 |
return d; |
| 498 |
} |
| 499 |
}, |
| 500 |
{ |
| 501 |
name: name + " delete period after refocus", |
| 502 |
timeout: 2000, |
| 503 |
runTest: function(){ |
| 504 |
var d = new doh.Deferred(); |
| 505 |
testOn('input', textbox, d, function(){ |
| 506 |
doh.t(textbox.isValid(true), "isValid"); |
| 507 |
doh.is("", textbox.state, "state"); |
| 508 |
doh.is("", tooltip, "tooltip"); |
| 509 |
}); |
| 510 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 511 |
return d; |
| 512 |
} |
| 513 |
}, |
| 514 |
{ |
| 515 |
name: name + " delete last in-range character", |
| 516 |
timeout: 2000, |
| 517 |
runTest: function(){ |
| 518 |
var d = new doh.Deferred(); |
| 519 |
testOn('input', textbox, d, function(){ |
| 520 |
doh.is(rangeBound ? "Incomplete" : "", textbox.state, "state"); |
| 521 |
doh.is(rangeBound? promptMessage : "", tooltip, "tooltip"); |
| 522 |
}); |
| 523 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 524 |
return d; |
| 525 |
} |
| 526 |
}, |
| 527 |
{ |
| 528 |
name: name + " delete remaining character", |
| 529 |
timeout: 2000, |
| 530 |
runTest: function(){ |
| 531 |
var d = new doh.Deferred(); |
| 532 |
testOn('input', textbox, d, function(){ |
| 533 |
doh.is(!required, textbox.isValid(true), "isValid"); |
| 534 |
doh.is(required ? "Incomplete" : "", textbox.state, "state"); |
| 535 |
doh.is(promptMessage, tooltip, "tooltip"); |
| 536 |
}); |
| 537 |
doh.robot.keyPress(dojo.keys.BACKSPACE, 0); |
| 538 |
return d; |
| 539 |
} |
| 540 |
}, |
| 541 |
{ |
| 542 |
name: name + " tab from empty 2", |
| 543 |
timeout: 2000, |
| 544 |
runTest: function(){ |
| 545 |
var d = new doh.Deferred(); |
| 546 |
testOn('blur', textbox, d, function(){ |
| 547 |
doh.is(!required, textbox.isValid(false), "isValid"); |
| 548 |
doh.is(required ? "Error" : "", textbox.state, "state"); |
| 549 |
doh.is("", tooltip, "no tooltip"); |
| 550 |
doh.is(required? (missingMessage||invalidMessage||promptMessage) : promptMessage, textbox.message, "message"); |
| 551 |
}); |
| 552 |
doh.robot.keyPress(dojo.keys.TAB, 0); |
| 553 |
return d; |
| 554 |
} |
| 555 |
}, |
| 556 |
{ |
| 557 |
name: name + " tab back to empty 2", |
| 558 |
timeout: 2000, |
| 559 |
runTest: function(){ |
| 560 |
var d = new doh.Deferred(); |
| 561 |
testOn('focus', textbox, d, function(){ |
| 562 |
doh.is(!required, textbox.isValid(false), "isValid"); |
| 563 |
doh.is(required ? "Error" : "", textbox.state, "state"); |
| 564 |
doh.is(required? (missingMessage||invalidMessage||promptMessage) : promptMessage, tooltip, "tooltip"); |
| 565 |
}); |
| 566 |
doh.robot.keyPress(dojo.keys.TAB, 0, { shift:true }); |
| 567 |
return d; |
| 568 |
} |
| 569 |
}]); |
| 570 |
}); |
| 571 |
}); |
| 572 |
}); |
| 573 |
}); |
| 574 |
}); |
| 575 |
|
| 576 |
doh.run(); |
| 577 |
}); |
| 578 |
</script> |
| 579 |
</head> |
| 580 |
<body> |
| 581 |
<label for="t00000">not required, no min/max, no prompt message, no invalid message, no missing message</label><br> |
| 582 |
<input id="t00000" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:false, promptMessage:"", invalidMessage:"", missingMessage:"", rangeMessage:"r"'/> |
| 583 |
<input style="border:0;" size="6" value="t00000"/><br> |
| 584 |
|
| 585 |
<label for="t00001">not required, no min/max, no prompt message, no invalid message, missing message</label><br> |
| 586 |
<input id="t00001" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:false, promptMessage:"", invalidMessage:"", missingMessage:"m", rangeMessage:"r"'/> |
| 587 |
<input style="border:0;" size="6" value="t00001"/><br> |
| 588 |
|
| 589 |
<label for="t00010">not required, no min/max, no prompt message, invalid message, no missing message</label><br> |
| 590 |
<input id="t00010" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:false, promptMessage:"", invalidMessage:"i", missingMessage:"", rangeMessage:"r"'/> |
| 591 |
<input style="border:0;" size="6" value="t00010"/><br> |
| 592 |
|
| 593 |
<label for="t00011">not required, no min/max, no prompt message, invalid message, missing message</label><br> |
| 594 |
<input id="t00011" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:false, promptMessage:"", invalidMessage:"i", missingMessage:"m", rangeMessage:"r"'/> |
| 595 |
<input style="border:0;" size="6" value="t00011"/><br> |
| 596 |
|
| 597 |
<label for="t00100">not required, no min/max, prompt message, no invalid message, no missing message</label><br> |
| 598 |
<input id="t00100" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:false, promptMessage:"p", invalidMessage:"", missingMessage:"", rangeMessage:"r"'/> |
| 599 |
<input style="border:0;" size="6" value="t00100"/><br> |
| 600 |
|
| 601 |
<label for="t00101">not required, no min/max, prompt message, no invalid message, missing message</label><br> |
| 602 |
<input id="t00101" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:false, promptMessage:"p", invalidMessage:"", missingMessage:"m", rangeMessage:"r"'/> |
| 603 |
<input style="border:0;" size="6" value="t00101"/><br> |
| 604 |
|
| 605 |
<label for="t00110">not required, no min/max, prompt message, invalid message, no missing message</label><br> |
| 606 |
<input id="t00110" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:false, promptMessage:"p", invalidMessage:"i", missingMessage:"", rangeMessage:"r"'/> |
| 607 |
<input style="border:0;" size="6" value="t00110"/><br> |
| 608 |
|
| 609 |
<label for="t00111">not required, no min/max, prompt message, invalid message, missing message</label><br> |
| 610 |
<input id="t00111" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:false, promptMessage:"p", invalidMessage:"i", missingMessage:"m", rangeMessage:"r"'/> |
| 611 |
<input style="border:0;" size="6" value="t00111"/><br> |
| 612 |
|
| 613 |
<label for="t01000">required, no min/max, no prompt message, no invalid message, no missing message</label><br> |
| 614 |
<input id="t01000" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:true, promptMessage:"", invalidMessage:"", missingMessage:"", rangeMessage:"r"'/> |
| 615 |
<input style="border:0;" size="6" value="t01000"/><br> |
| 616 |
|
| 617 |
<label for="t01001">required, no min/max, no prompt message, no invalid message, missing message</label><br> |
| 618 |
<input id="t01001" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:true, promptMessage:"", invalidMessage:"", missingMessage:"m", rangeMessage:"r"'/> |
| 619 |
<input style="border:0;" size="6" value="t01001"/><br> |
| 620 |
|
| 621 |
<label for="t01010">required, no min/max, no prompt message, invalid message, no missing message</label><br> |
| 622 |
<input id="t01010" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:true, promptMessage:"", invalidMessage:"i", missingMessage:"", rangeMessage:"r"'/> |
| 623 |
<input style="border:0;" size="6" value="t01010"/><br> |
| 624 |
|
| 625 |
<label for="t01011">required, no min/max, no prompt message, invalid message, missing message</label><br> |
| 626 |
<input id="t01011" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:true, promptMessage:"", invalidMessage:"i", missingMessage:"m", rangeMessage:"r"'/> |
| 627 |
<input style="border:0;" size="6" value="t01011"/><br> |
| 628 |
|
| 629 |
<label for="t01100">required, no min/max, prompt message, no invalid message, no missing message</label><br> |
| 630 |
<input id="t01100" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:true, promptMessage:"p", invalidMessage:"", missingMessage:"", rangeMessage:"r"'/> |
| 631 |
<input style="border:0;" size="6" value="t01100"/><br> |
| 632 |
|
| 633 |
<label for="t01101">required, no min/max, prompt message, no invalid message, missing message</label><br> |
| 634 |
<input id="t01101" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:true, promptMessage:"p", invalidMessage:"", missingMessage:"m", rangeMessage:"r"'/> |
| 635 |
<input style="border:0;" size="6" value="t01101"/><br> |
| 636 |
|
| 637 |
<label for="t01110">required, no min/max, prompt message, invalid message, no missing message</label><br> |
| 638 |
<input id="t01110" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:true, promptMessage:"p", invalidMessage:"i", missingMessage:"", rangeMessage:"r"'/> |
| 639 |
<input style="border:0;" size="6" value="t01110"/><br> |
| 640 |
|
| 641 |
<label for="t01111">required, no min/max, prompt message, invalid message, missing message</label><br> |
| 642 |
<input id="t01111" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false] }, required:true, promptMessage:"p", invalidMessage:"i", missingMessage:"m", rangeMessage:"r"'/> |
| 643 |
<input style="border:0;" size="6" value="t01111"/><br> |
| 644 |
|
| 645 |
<label for="t10000">not required, min=10, max=100, no prompt message, no invalid message, no missing message</label><br> |
| 646 |
<input id="t10000" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:false, promptMessage:"", invalidMessage:"", missingMessage:"", rangeMessage:"r"'/> |
| 647 |
<input style="border:0;" size="6" value="t10000"/><br> |
| 648 |
|
| 649 |
<label for="t10001">not required, min=10, max=100, no prompt message, no invalid message, missing message</label><br> |
| 650 |
<input id="t10001" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:false, promptMessage:"", invalidMessage:"", missingMessage:"m", rangeMessage:"r"'/> |
| 651 |
<input style="border:0;" size="6" value="t10001"/><br> |
| 652 |
|
| 653 |
<label for="t10010">not required, min=10, max=100, no prompt message, invalid message, no missing message</label><br> |
| 654 |
<input id="t10010" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:false, promptMessage:"", invalidMessage:"i", missingMessage:"", rangeMessage:"r"'/> |
| 655 |
<input style="border:0;" size="6" value="t10010"/><br> |
| 656 |
|
| 657 |
<label for="t10011">not required, min=10, max=100, no prompt message, invalid message, missing message</label><br> |
| 658 |
<input id="t10011" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:false, promptMessage:"", invalidMessage:"i", missingMessage:"m", rangeMessage:"r"'/> |
| 659 |
<input style="border:0;" size="6" value="t10011"/><br> |
| 660 |
|
| 661 |
<label for="t10100">not required, min=10, max=100, prompt message, no invalid message, no missing message</label><br> |
| 662 |
<input id="t10100" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:false, promptMessage:"p", invalidMessage:"", missingMessage:"", rangeMessage:"r"'/> |
| 663 |
<input style="border:0;" size="6" value="t10100"/><br> |
| 664 |
|
| 665 |
<label for="t10101">not required, min=10, max=100, prompt message, no invalid message, missing message</label><br> |
| 666 |
<input id="t10101" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:false, promptMessage:"p", invalidMessage:"", missingMessage:"m", rangeMessage:"r"'/> |
| 667 |
<input style="border:0;" size="6" value="t10101"/><br> |
| 668 |
|
| 669 |
<label for="t10110">not required, min=10, max=100, prompt message, invalid message, no missing message</label><br> |
| 670 |
<input id="t10110" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:false, promptMessage:"p", invalidMessage:"i", missingMessage:"", rangeMessage:"r"'/> |
| 671 |
<input style="border:0;" size="6" value="t10110"/><br> |
| 672 |
|
| 673 |
<label for="t10111">not required, min=10, max=100, prompt message, invalid message, missing message</label><br> |
| 674 |
<input id="t10111" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:false, promptMessage:"p", invalidMessage:"i", missingMessage:"m", rangeMessage:"r"'/> |
| 675 |
<input style="border:0;" size="6" value="t10111"/><br> |
| 676 |
|
| 677 |
<label for="t11000">required, min=10, max=100, no prompt message, no invalid message, no missing message</label><br> |
| 678 |
<input id="t11000" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:true, promptMessage:"", invalidMessage:"", missingMessage:"", rangeMessage:"r"'/> |
| 679 |
<input style="border:0;" size="6" value="t11000"/><br> |
| 680 |
|
| 681 |
<label for="t11001">required, min=10, max=100, no prompt message, no invalid message, missing message</label><br> |
| 682 |
<input id="t11001" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:true, promptMessage:"", invalidMessage:"", missingMessage:"m", rangeMessage:"r"'/> |
| 683 |
<input style="border:0;" size="6" value="t11001"/><br> |
| 684 |
|
| 685 |
<label for="t11010">required, min=10, max=100, no prompt message, invalid message, no missing message</label><br> |
| 686 |
<input id="t11010" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:true, promptMessage:"", invalidMessage:"i", missingMessage:"", rangeMessage:"r"'/> |
| 687 |
<input style="border:0;" size="6" value="t11010"/><br> |
| 688 |
|
| 689 |
<label for="t11011">required, min=10, max=100, no prompt message, invalid message, missing message</label><br> |
| 690 |
<input id="t11011" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:true, promptMessage:"", invalidMessage:"i", missingMessage:"m", rangeMessage:"r"'/> |
| 691 |
<input style="border:0;" size="6" value="t11011"/><br> |
| 692 |
|
| 693 |
<label for="t11100">required, min=10, max=100, prompt message, no invalid message, no missing message</label><br> |
| 694 |
<input id="t11100" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:true, promptMessage:"p", invalidMessage:"", missingMessage:"", rangeMessage:"r"'/> |
| 695 |
<input style="border:0;" size="6" value="t11100"/><br> |
| 696 |
|
| 697 |
<label for="t11101">required, min=10, max=100, prompt message, no invalid message, missing message</label><br> |
| 698 |
<input id="t11101" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:true, promptMessage:"p", invalidMessage:"", missingMessage:"m", rangeMessage:"r"'/> |
| 699 |
<input style="border:0;" size="6" value="t11101"/><br> |
| 700 |
|
| 701 |
<label for="t11110">required, min=10, max=100, prompt message, invalid message, no missing message</label><br> |
| 702 |
<input id="t11110" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:true, promptMessage:"p", invalidMessage:"i", missingMessage:"", rangeMessage:"r"'/> |
| 703 |
<input style="border:0;" size="6" value="t11110"/><br> |
| 704 |
|
| 705 |
<label for="t11111">required, min=10, max=100, prompt message, invalid message, missing message</label><br> |
| 706 |
<input id="t11111" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props='constraints:{ fractional:[true,false], min:10, max:100 }, required:true, promptMessage:"p", invalidMessage:"i", missingMessage:"m", rangeMessage:"r"'/> |
| 707 |
<input style="border:0;" size="6" value="t11111"/><br> |
| 708 |
|
| 709 |
</body> |
| 710 |
</html> |
| 711 |
|