| 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>robot TooltipDialog Mouse Test</title> |
| 6 |
|
| 7 |
<style> |
| 8 |
@import "../../../util/doh/robot/robot.css"; |
| 9 |
</style> |
| 10 |
|
| 11 |
|
| 12 |
<script type="text/javascript" src="../../../dojo/dojo.js" |
| 13 |
data-dojo-config="isDebug: true"></script> |
| 14 |
|
| 15 |
<script type="text/javascript"> |
| 16 |
require([ |
| 17 |
"doh/runner", "dojo/robotx", |
| 18 |
"dojo/dom", "dojo/query", |
| 19 |
"dijit/tests/helpers", "dojo/domReady!" |
| 20 |
], function(doh, robot, dom, query, helpers){ |
| 21 |
robot.initRobot('../test_TooltipDialog.html'); |
| 22 |
|
| 23 |
doh.register("setup", function setup(){ |
| 24 |
// get pointer to registry in the iframe |
| 25 |
registry = robot.window.require("dijit/registry"); |
| 26 |
dfocus = robot.window.require("dijit/focus"); |
| 27 |
}); |
| 28 |
|
| 29 |
doh.register("Select", [ |
| 30 |
{ |
| 31 |
name: "open TooltipDialog", |
| 32 |
timeout: 10000, |
| 33 |
runTest: function(){ |
| 34 |
var d = new doh.Deferred(); |
| 35 |
|
| 36 |
robot.mouseMoveAt("tooltipDlgButton", 1000); |
| 37 |
robot.mouseClick({left: true}, 1000); |
| 38 |
robot.sequence(d.getTestCallback(function(){ |
| 39 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog visible"); |
| 40 |
doh.is("inline", dfocus.curNode.id, "focus on InlineEditBox (first field in TooltipDialog)") |
| 41 |
}), 1000); |
| 42 |
|
| 43 |
return d; |
| 44 |
} |
| 45 |
}, |
| 46 |
|
| 47 |
{ |
| 48 |
name: "pick option from Select drop down", |
| 49 |
timeout: 10000, |
| 50 |
runTest: function(){ |
| 51 |
var d = new doh.Deferred(), |
| 52 |
select = registry.byId("select"); |
| 53 |
|
| 54 |
// open Select |
| 55 |
robot.mouseMoveAt("select", 0); |
| 56 |
robot.mouseClick({left: true}, 1000); |
| 57 |
robot.sequence(d.getTestErrback(function(){ |
| 58 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still be showing"); |
| 59 |
doh.t(helpers.isVisible("select_menu"), "Select Menu showing too"); |
| 60 |
}), 1000); |
| 61 |
|
| 62 |
// pick second option |
| 63 |
robot.mouseMoveAt(function(){ |
| 64 |
return query("tr", dom.byId("select_menu"))[1]; |
| 65 |
}, 0); |
| 66 |
robot.mouseClick({left: true}, 1000); |
| 67 |
|
| 68 |
robot.sequence(d.getTestCallback(function(){ |
| 69 |
doh.t(helpers.isHidden("select_menu"), "Select Menu closed"); |
| 70 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still still be showing"); |
| 71 |
doh.is("peppers", select.get("value"), "selected peppers"); |
| 72 |
}), 1000); |
| 73 |
|
| 74 |
return d; |
| 75 |
} |
| 76 |
}, |
| 77 |
|
| 78 |
{ |
| 79 |
name: "close Select by clicking TooltipDialog", |
| 80 |
timeout: 10000, |
| 81 |
runTest: function(){ |
| 82 |
var d = new doh.Deferred(), |
| 83 |
select = registry.byId("select"); |
| 84 |
|
| 85 |
// open Select |
| 86 |
robot.mouseMoveAt("select", 0); |
| 87 |
robot.mouseClick({left: true}, 1000); |
| 88 |
robot.sequence(d.getTestErrback(function(){ |
| 89 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still be showing"); |
| 90 |
doh.t(helpers.isVisible("select_menu"), "Select Menu showing too"); |
| 91 |
}), 1000); |
| 92 |
|
| 93 |
// click unfocusable area of TooltipDialog to get select to close |
| 94 |
// (but TooltipDialog itself should remain open) |
| 95 |
robot.mouseMoveAt(function(){ |
| 96 |
return query("label[for='select']", dom.byId("tooltipDlg"))[0]; |
| 97 |
}, 0); |
| 98 |
robot.mouseClick({left: true}, 1000); |
| 99 |
|
| 100 |
robot.sequence(d.getTestCallback(function(){ |
| 101 |
doh.t(helpers.isHidden("select_menu"), "Select Menu closed"); |
| 102 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still still be showing"); |
| 103 |
}), 1000); |
| 104 |
|
| 105 |
return d; |
| 106 |
} |
| 107 |
}, |
| 108 |
{ |
| 109 |
name: "close select by clicking another control", |
| 110 |
timeout: 10000, |
| 111 |
runTest: function(){ |
| 112 |
var d = new doh.Deferred(), |
| 113 |
select = registry.byId("select"); |
| 114 |
|
| 115 |
// open Select |
| 116 |
robot.mouseMoveAt("select", 0); |
| 117 |
robot.mouseClick({left: true}, 1000); |
| 118 |
robot.sequence(d.getTestErrback(function(){ |
| 119 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still be showing"); |
| 120 |
doh.t(helpers.isVisible("select_menu"), "Select Menu showing too"); |
| 121 |
}), 1000); |
| 122 |
|
| 123 |
// click TextBox to get select to close |
| 124 |
robot.mouseMoveAt("text", 0); |
| 125 |
robot.mouseClick({left: true}, 1000); |
| 126 |
|
| 127 |
robot.sequence(d.getTestCallback(function(){ |
| 128 |
doh.t(helpers.isHidden("select_menu"), "Select Menu closed"); |
| 129 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still still be showing"); |
| 130 |
doh.is("text", dfocus.curNode && dfocus.curNode.id, "focused on textbox") |
| 131 |
}), 1000); |
| 132 |
|
| 133 |
return d; |
| 134 |
} |
| 135 |
}, |
| 136 |
|
| 137 |
{ |
| 138 |
name: "close TooltipDialog", |
| 139 |
timeout: 10000, |
| 140 |
runTest: function(){ |
| 141 |
var d = new doh.Deferred(); |
| 142 |
|
| 143 |
robot.mouseMove(10, 10, 0); |
| 144 |
robot.mouseClick({left: true}, 1000); |
| 145 |
|
| 146 |
robot.sequence(d.getTestCallback(function(){ |
| 147 |
doh.t(helpers.isHidden("tooltipDlg"), "Tooltip dialog closed"); |
| 148 |
}), 500); |
| 149 |
|
| 150 |
return d; |
| 151 |
} |
| 152 |
} |
| 153 |
]); |
| 154 |
|
| 155 |
doh.register("InlineEditBox", [ |
| 156 |
{ |
| 157 |
name: "auto-save", |
| 158 |
timeout: 20000, |
| 159 |
runTest: function(){ |
| 160 |
var d = new doh.Deferred(), |
| 161 |
inlineEditBox = registry.byId("inline"); |
| 162 |
|
| 163 |
// open TooltipDialog |
| 164 |
robot.mouseMoveAt("tooltipDlgButton", 500); |
| 165 |
robot.mouseClick({left: true}, 1000); |
| 166 |
robot.sequence(d.getTestErrback(function(){ |
| 167 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog visible"); |
| 168 |
}), 1000); |
| 169 |
|
| 170 |
// start editing InlineEditBox |
| 171 |
robot.mouseMoveAt("inline", 0, 500, 10, 5); |
| 172 |
robot.mouseClick({left: true}, 1000); |
| 173 |
robot.sequence(d.getTestErrback(function(){ |
| 174 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still be showing"); |
| 175 |
doh.t(inlineEditBox.editing, "InlineEditBox in edit mode"); |
| 176 |
}), 1000); |
| 177 |
|
| 178 |
// type something |
| 179 |
robot.typeKeys("changed", 0, 600); |
| 180 |
|
| 181 |
// close InlineEditBox by clicking on blank area of TooltipDialog |
| 182 |
robot.mouseMoveAt("tooltipDlg", 0, 500, 10, 20); |
| 183 |
robot.mouseClick({left: true}, 1000); |
| 184 |
robot.sequence(d.getTestErrback(function(){ |
| 185 |
doh.f(inlineEditBox.editing, "InlineEditBox no longer in edit mode"); |
| 186 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still still be showing"); |
| 187 |
doh.is("changed", inlineEditBox.get("value"), "value changed to changed"); |
| 188 |
}), 1000); |
| 189 |
|
| 190 |
// close TooltipDialog |
| 191 |
robot.mouseMove(10, 10, 0); |
| 192 |
robot.mouseClick({left: true}, 1000); |
| 193 |
|
| 194 |
robot.sequence(d.getTestCallback(function(){ |
| 195 |
doh.t(helpers.isHidden("tooltipDlg"), "Tooltip dialog closed"); |
| 196 |
}), 500); |
| 197 |
|
| 198 |
return d; |
| 199 |
} |
| 200 |
} |
| 201 |
]); |
| 202 |
|
| 203 |
doh.register("DateTextBox", [ |
| 204 |
{ |
| 205 |
name: "open TooltipDialog", |
| 206 |
timeout: 10000, |
| 207 |
runTest: function(){ |
| 208 |
var d = new doh.Deferred(); |
| 209 |
|
| 210 |
robot.mouseMoveAt("tooltipDlgButton", 1000); |
| 211 |
robot.mouseClick({left: true}, 1000); |
| 212 |
robot.sequence(d.getTestCallback(function(){ |
| 213 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog visible"); |
| 214 |
doh.is("inline", dfocus.curNode.id, "focus on InlineEditBox (first field in TooltipDialog)") |
| 215 |
}), 1000); |
| 216 |
|
| 217 |
return d; |
| 218 |
} |
| 219 |
}, |
| 220 |
|
| 221 |
{ |
| 222 |
name: "open DateTextBox by clicking arrow", |
| 223 |
timeout: 10000, |
| 224 |
runTest: function(){ |
| 225 |
var d = new doh.Deferred(), |
| 226 |
date = registry.byId("date2"); |
| 227 |
|
| 228 |
// click arrow to open |
| 229 |
robot.mouseMoveAt(function(){ |
| 230 |
return query(".dijitArrowButton", date.domNode)[0]; |
| 231 |
}, 0); |
| 232 |
robot.mouseClick({left: true}, 1000); |
| 233 |
robot.sequence(d.getTestCallback(function(){ |
| 234 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still be showing"); |
| 235 |
doh.t(helpers.isVisible("date2_popup"), "Calendar showing too"); |
| 236 |
}), 1000); |
| 237 |
|
| 238 |
return d; |
| 239 |
} |
| 240 |
}, |
| 241 |
|
| 242 |
{ |
| 243 |
name: "close DateTextBox by clicking arrow", |
| 244 |
timeout: 10000, |
| 245 |
runTest: function(){ |
| 246 |
var d = new doh.Deferred(), |
| 247 |
date = registry.byId("date2"); |
| 248 |
|
| 249 |
// click arrow to open |
| 250 |
robot.mouseMoveAt(function(){ |
| 251 |
return query(".dijitArrowButton", date.domNode)[0]; |
| 252 |
}, 0); |
| 253 |
robot.mouseClick({left: true}, 1000); |
| 254 |
robot.sequence(d.getTestCallback(function(){ |
| 255 |
doh.t(helpers.isVisible("tooltipDlg"), "TooltipDialog should still be showing"); |
| 256 |
doh.t(helpers.isHidden("date2_popup"), "calendar closed"); |
| 257 |
}), 1000); |
| 258 |
|
| 259 |
return d; |
| 260 |
} |
| 261 |
}, |
| 262 |
|
| 263 |
{ |
| 264 |
name: "close TooltipDialog", |
| 265 |
timeout: 10000, |
| 266 |
runTest: function(){ |
| 267 |
var d = new doh.Deferred(); |
| 268 |
|
| 269 |
robot.mouseMove(10, 10, 0); |
| 270 |
robot.mouseClick({left: true}, 1000); |
| 271 |
|
| 272 |
robot.sequence(d.getTestCallback(function(){ |
| 273 |
doh.t(helpers.isHidden("tooltipDlg"), "Tooltip dialog closed"); |
| 274 |
}), 500); |
| 275 |
|
| 276 |
return d; |
| 277 |
} |
| 278 |
} |
| 279 |
]); |
| 280 |
|
| 281 |
doh.register("Menu", [ |
| 282 |
{ |
| 283 |
name: "open outer TooltipDialog", |
| 284 |
timeout: 10000, |
| 285 |
runTest: function(){ |
| 286 |
var d = new doh.Deferred(); |
| 287 |
|
| 288 |
robot.mouseMoveAt("outerDdBtn", 1000); |
| 289 |
robot.mouseClick({left: true}, 1000); |
| 290 |
robot.sequence(d.getTestCallback(function(){ |
| 291 |
doh.t(helpers.isVisible("outerTtDialog"), "Outer TooltipDialog visible"); |
| 292 |
}), 1000); |
| 293 |
|
| 294 |
return d; |
| 295 |
} |
| 296 |
}, |
| 297 |
{ |
| 298 |
name: "open inner TooltipDialog", |
| 299 |
timeout: 10000, |
| 300 |
runTest: function(){ |
| 301 |
var d = new doh.Deferred(); |
| 302 |
|
| 303 |
robot.mouseMoveAt("innerDdBtn", 1000); |
| 304 |
robot.mouseClick({left: true}, 1000); |
| 305 |
robot.sequence(d.getTestCallback(function(){ |
| 306 |
doh.t(helpers.isVisible("innerTtDialog"), "Inner TooltipDialog visible"); |
| 307 |
}), 1000); |
| 308 |
|
| 309 |
return d; |
| 310 |
} |
| 311 |
}, |
| 312 |
|
| 313 |
{ |
| 314 |
name: "open submenu", |
| 315 |
timeout: 10000, |
| 316 |
runTest: function(){ |
| 317 |
var d = new doh.Deferred(); |
| 318 |
|
| 319 |
robot.mouseMoveAt("popupMenuItem", 0); |
| 320 |
robot.mouseClick({left: true}, 1000); |
| 321 |
robot.sequence(d.getTestCallback(function(){ |
| 322 |
doh.t(helpers.isVisible("innerTtDialog"), "inner TooltipDialog should still be showing"); |
| 323 |
doh.t(helpers.isVisible("submenu"), "nested Menu showing too"); |
| 324 |
}), 1000); |
| 325 |
|
| 326 |
return d; |
| 327 |
} |
| 328 |
}, |
| 329 |
|
| 330 |
{ |
| 331 |
name: "close submenu by clicking inner TooltipDialog", |
| 332 |
timeout: 10000, |
| 333 |
runTest: function(){ |
| 334 |
var d = new doh.Deferred(); |
| 335 |
|
| 336 |
robot.mouseMoveAt("plaintext", 0); |
| 337 |
robot.mouseClick({left: true}, 1000); |
| 338 |
robot.sequence(d.getTestCallback(function(){ |
| 339 |
doh.t(helpers.isVisible("innerTtDialog"), "Inner TooltipDialog should still be showing"); |
| 340 |
doh.t(helpers.isHidden("submenu"), "SubMenu was closed"); |
| 341 |
}), 1000); |
| 342 |
|
| 343 |
return d; |
| 344 |
} |
| 345 |
}, |
| 346 |
|
| 347 |
{ |
| 348 |
name: "open submenu again", |
| 349 |
timeout: 10000, |
| 350 |
runTest: function(){ |
| 351 |
var d = new doh.Deferred(); |
| 352 |
|
| 353 |
robot.mouseMoveAt("popupMenuItem", 0); |
| 354 |
robot.mouseClick({left: true}, 1000); |
| 355 |
robot.sequence(d.getTestCallback(function(){ |
| 356 |
doh.t(helpers.isVisible("innerTtDialog"), "inner TooltipDialog should still be showing"); |
| 357 |
doh.t(helpers.isVisible("submenu"), "nested Menu showing too"); |
| 358 |
}), 1000); |
| 359 |
|
| 360 |
return d; |
| 361 |
} |
| 362 |
}, |
| 363 |
|
| 364 |
{ |
| 365 |
name: "close submenu by clicking another control", |
| 366 |
timeout: 10000, |
| 367 |
runTest: function(){ |
| 368 |
var d = new doh.Deferred(); |
| 369 |
|
| 370 |
// click TextBox to get submenu to close |
| 371 |
robot.mouseMoveAt("name", 0); |
| 372 |
robot.mouseClick({left: true}, 1000); |
| 373 |
|
| 374 |
robot.sequence(d.getTestCallback(function(){ |
| 375 |
doh.t(helpers.isHidden("submenu"), "submenu closed"); |
| 376 |
doh.t(helpers.isVisible("innerTtDialog"), "TooltipDialog should still still be showing"); |
| 377 |
doh.is("name", dfocus.curNode && dfocus.curNode.id, "focused on textbox") |
| 378 |
}), 1000); |
| 379 |
|
| 380 |
return d; |
| 381 |
} |
| 382 |
}, |
| 383 |
|
| 384 |
{ |
| 385 |
name: "close both TooltipDialogs", |
| 386 |
timeout: 10000, |
| 387 |
runTest: function(){ |
| 388 |
var d = new doh.Deferred(); |
| 389 |
|
| 390 |
robot.mouseMove(10, 10, 0); |
| 391 |
robot.mouseClick({left: true}, 1000); |
| 392 |
|
| 393 |
robot.sequence(d.getTestCallback(function(){ |
| 394 |
doh.t(helpers.isHidden("innerTtDialog"), "inner Tooltip dialog closed"); |
| 395 |
doh.t(helpers.isHidden("outerTtDialog"), "inner Tooltip dialog closed"); |
| 396 |
}), 500); |
| 397 |
|
| 398 |
return d; |
| 399 |
} |
| 400 |
} |
| 401 |
]); |
| 402 |
|
| 403 |
doh.run(); |
| 404 |
}); |
| 405 |
</script> |
| 406 |
</head> |
| 407 |
</html> |