Debian Codegraph @

dijit/tests/robot/Menu_mouse.html

raw symbols SCIP
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 Menu Mouse Tests</title>
6
7 <style>
8 @import "../../../util/doh/robot/robot.css";
9 </style>
10
11 <!-- required: dojo.js -->
12 <script type="text/javascript" src="../../../dojo/dojo.js"></script>
13
14 <script type="text/javascript">
15 require([
16 "doh/runner", "dojo/robotx",
17 "dojo/dom", "dojo/dom-class", "dojo/dom-geometry", "dojo/keys",
18 "dijit/tests/helpers", "dojo/domReady!"
19 ], function(doh, robot, dom, domClass, domGeom, keys, helpers){
20
21 robot.initRobot('../test_Menu.html');
22
23 doh.register(function setup(){
24 // get pointer to registry in the iframe
25 registry = robot.window.require("dijit/registry");
26 });
27
28 doh.register("dijit.MenuBar mouse tests", [
29
30 {
31 name: "mouse over file MenuBarItem",
32 timeout: 4000,
33 runTest: function(){
34 var d = new doh.Deferred();
35
36 // Check initial conditions
37 doh.f(domClass.contains("file", "dijitMenuItemHover"), "File MenuBarItem doesn't have hover effect");
38 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden");
39
40 // Move over the File MenuBarItem
41 robot.mouseMoveAt("file", 500, 1000);
42
43 robot.sequence(d.getTestCallback(function(){
44 // The "File" MenuBarItem should be highlighted
45 doh.t(domClass.contains("file", "dijitMenuItemHover"),
46 "File MenuBarItem should have hover effect, actual class is: " + dom.byId("file").className);
47
48 // However, just moving over the MenuBarItem shouldn't have opened the menu
49 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden");
50 }), 1000); // 1000ms == give IE time to make that background iframe
51
52 return d;
53 }
54 },
55
56 {
57 name: "click on file MenuBarItem",
58 timeout: 4000,
59 runTest: function(){
60 var d = new doh.Deferred();
61
62 // click the File MenuBarItem
63 robot.mouseMoveAt("file", 500, 1);
64 robot.mouseClick({left: true}, 500);
65
66 robot.sequence(d.getTestCallback(function(){
67 // The "File" MenuBarItem should have the selected class in addition to the hover
68 // class
69 doh.t(domClass.contains("file", "dijitMenuItemHover"),
70 "File MenuBarItem should have hover effect, actual class is: " + dom.byId("file").className);
71 doh.t(domClass.contains("file", "dijitMenuItemSelected"),
72 "File MenuBarItem should have selected class, actual class is: " + dom.byId("file").className);
73
74 // And the file menu should be visible
75 doh.t(helpers.isVisible("fileMenu"), "File menu is visible");
76
77 // But the first item in the file menu should not be selected, since we opened via mouse not keyboard (#10716)
78 doh.f(domClass.contains("new", "dijitMenuItemSelected"),
79 "New MenuItem should not have selected class, actual class is: " + dom.byId("new").className);
80 }), 1000);
81
82 return d;
83 }
84 },
85
86 {
87 name: "hover edit menu item",
88 timeout: 4000,
89 runTest: function(){
90 var d = new doh.Deferred();
91
92 robot.mouseMoveAt("edit", 500, 500);
93
94 robot.sequence(d.getTestCallback(function(){
95 // Since we've already activated the MenuBar by clicking "File",
96 // hovering over "Edit" should automatically show the edit menu
97 doh.t(helpers.isVisible("editMenu"), "Edit menu is visible");
98
99 // And also, the file menu should have disappeared
100 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden");
101 }), 500);
102
103 return d;
104 }
105 },
106
107 {
108 name: "move to copy",
109 timeout: 4000,
110 runTest: function(){
111 var d = new doh.Deferred();
112
113 robot.mouseMoveAt("copy", 500, 500);
114
115 robot.sequence(d.getTestCallback(function(){
116 doh.f(domClass.contains("edit", "dijitMenuItemHover"),
117 "Edit MenuBarItem shouldn't have hover effect anymore, actual class is: " + dom.byId("edit").className);
118 doh.t(domClass.contains("edit", "dijitMenuItemSelected"),
119 "Edit MenuBarItem should still have selected class, actual class is: " + dom.byId("edit").className);
120
121 doh.t(domClass.contains("copy", "dijitMenuItemHover"),
122 "Copy Menu item should have hover effect, actual class is: " + dom.byId("copy").className);
123 doh.t(domClass.contains("copy", "dijitMenuItemSelected"),
124 "Copy Menu item should have selected effect, actual class is: " + dom.byId("copy").className);
125 }), 500);
126
127 return d;
128 }
129 },
130
131 {
132 name: "click copy",
133 timeout: 2000,
134 runTest: function(){
135 var d = new doh.Deferred();
136
137 var w = registry.byId("copy");
138 var orig = w.onClick;
139 w.onClick = d.getTestCallback(function(){
140 w.onClick = orig;
141 doh.t(helpers.isHidden("editMenu"), "edit menu disappeared");
142 doh.f(domClass.contains("edit", "dijitMenuItemSelected"),
143 "Edit MenuBarItem should no longer have selected effect, actual class is: " + dom.byId("edit").className);
144 });
145
146 robot.mouseClick({left: true}, 1);
147
148 return d;
149 }
150 },
151
152 {
153 name: "mouse over file MenuBarItem again",
154 timeout: 4000,
155 runTest: function(){
156 var d = new doh.Deferred();
157
158 // Check initial conditions
159 doh.f(domClass.contains("file", "dijitMenuItemHover"), "File MenuBarItem doesn't have hover effect");
160 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden");
161
162 // Move over the File MenuBarItem
163 robot.mouseMoveAt("file", 500, 500);
164
165 robot.sequence(d.getTestCallback(function(){
166 // The "File" MenuBarItem should be highlighted
167 doh.t(domClass.contains("file", "dijitMenuItemHover"),
168 "File MenuBarItem should have hover effect, actual class is: " + dom.byId("file").className);
169
170 // However, it shouldn't be "selected", and
171 // just moving over the MenuBarItem shouldn't have opened the menu,
172 // given that after clicking above, the MenuBar should have reverted to it's
173 // "dormant" state so that it needs to be clicked again before menus show up automatically
174 doh.f(domClass.contains("file", "dijitMenuItemSelected"),
175 "File MenuBarItem shouldn't have selected effect, actual class is: " + dom.byId("file").className);
176 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden");
177 }), 500);
178
179 return d;
180 }
181 }
182 ]);
183
184
185 doh.register("Navigation menu mouse tests", [
186
187 {
188 name: "mouse over enabled submenu",
189 timeout: 4000,
190 runTest: function(){
191 var d = new doh.Deferred();
192
193 // Check initial conditions
194 doh.f(domClass.contains("navMenuPopupItem1", "dijitMenuItemHover"), "navMenuPopupItem1 MenuItem doesn't have hover effect");
195 doh.t(helpers.isHidden("navMenuSub1"), "sub menu is hidden");
196
197 robot.mouseMoveAt("navMenuPopupItem1", 500, 500);
198
199 robot.sequence(d.getTestCallback(function(){
200 // The "enabled submenu" MenuItem should be highlighted
201 doh.t(domClass.contains("navMenuPopupItem1", "dijitMenuItemHover"),
202 "'Enabled Submenu' MenuItem should have hover effect, actual class is: " + dom.byId("navMenuPopupItem1").className);
203
204 // However, just moving over the MenuItem shouldn't have opened the menu
205 doh.t(helpers.isHidden("navMenuSub1"), "sub menu is hidden");
206 }), 500);
207
208 return d;
209 }
210 },
211
212 {
213 name: "open submenu",
214 timeout: 4000,
215 runTest: function(){
216 var d = new doh.Deferred();
217
218 robot.mouseClick({left: true}, 500);
219
220 robot.sequence(d.getTestCallback(function(){
221 doh.t(domClass.contains("navMenuPopupItem1", "dijitMenuItemHover"),
222 "'Enabled Submenu' MenuItem should have hover effect, actual class is: " + dom.byId("navMenuPopupItem1").className);
223 doh.t(domClass.contains("navMenuPopupItem1", "dijitMenuItemSelected"),
224 "'Enabled Submenu' MenuItem should have selected effect, actual class is: " + dom.byId("navMenuPopupItem1").className);
225
226 // And the sub menu should be visible
227 doh.t(helpers.isVisible("navMenuSub1"), "sub menu is visible");
228
229 // But the first item in the sub menu should be selected, since opened by mouse, see #10716
230 doh.f(domClass.contains("navMenuSub1_item1", "dijitMenuItemSelected"),
231 "first item in sub menu should have selected class, actual class is: " + dom.byId("new").className);
232 }), 1000);
233
234 return d;
235 }
236 },
237
238 {
239 name: "toggle CheckedMenuItem",
240 timeout: 3000,
241 runTest: function(){
242 var d = new doh.Deferred();
243
244 doh.f(registry.byId("checked2").get('checked'), "not initially checked");
245
246 robot.mouseMoveAt("checked2", 500, 1);
247 robot.mouseClick({left: true}, 500);
248
249 robot.sequence(d.getTestCallback(function(){
250 doh.t(registry.byId("checked2").get('checked'), "now it's checked");
251 }), 500);
252
253 return d;
254 }
255 }
256 ]);
257
258 doh.register("Context menu mouse tests", [
259 {
260 name: "open global context menu (mouse)",
261 timeout: 4000,
262 runTest: function(){
263 var d = new doh.Deferred();
264
265 var menu = registry.byId("windowContextMenu");
266
267 doh.t(helpers.isHidden(menu), "menu should be initially hidden");
268
269 // click random point on screen
270 robot.mouseMoveAt("input", 500, 500);
271 robot.mouseClick({right: true}, 500);
272
273 robot.sequence(d.getTestCallback(function(){
274 doh.t(helpers.isVisible(menu), "menu is now shown");
275
276 var inputCoords = domGeom.position("input");
277 menuCoords = domGeom.position(menu.domNode);
278
279 doh.t(menuCoords.x > inputCoords.x, "to right of link left edge");
280 doh.t(menuCoords.x < inputCoords.x + inputCoords.w, "to left of link right edge");
281 doh.t(menuCoords.y > inputCoords.y, "menu (" + menuCoords.y + ") starts below top of link (" + inputCoords.y + ")");
282 doh.t(menuCoords.y < inputCoords.y + inputCoords.h, "menu (" + menuCoords.y + ") starts above bottom of link (" + inputCoords.y + "+" + inputCoords.h + ")");
283
284 doh.f(domClass.contains("windowContextMenuFirstChoice", "dijitMenuItemSelected"), "first choice not marked as selected");
285 }), 1000);
286
287 return d;
288 }
289 },
290
291 {
292 name: "close global context menu (mouse)",
293 timeout: 4000,
294 runTest: function(){
295 var d = new doh.Deferred();
296
297 var menu = registry.byId("windowContextMenu");
298
299 // close menu from above test
300 robot.mouseMove(2, 2, 100);
301 robot.mouseClick({left: true}, 100);
302
303 robot.sequence(d.getTestCallback(function(){
304 doh.t(helpers.isHidden(menu), "menu should be hidden again");
305 }), 500);
306
307 return d;
308 }
309 },
310
311 {
312 name: "open context menu over form widget (mouse)",
313 timeout: 5000,
314 runTest: function(){
315 var d = new doh.Deferred();
316
317 var menu = registry.byId("windowContextMenu");
318
319 doh.t(helpers.isHidden(menu), "menu should be initially hidden");
320
321 // right-click on form widget
322 robot.mouseMoveAt("formwidget", 500, 1);
323 robot.mouseClick({right: true}, 500);
324
325 robot.sequence(d.getTestCallback(function(){
326 doh.t(helpers.isVisible(menu), "menu is now shown");
327
328 var widgetCoords = domGeom.position("formwidget");
329 menuCoords = domGeom.position(menu.domNode);
330
331 doh.t(((menuCoords.x > widgetCoords.x) && (menuCoords.x < (widgetCoords.x + widgetCoords.w))) ||
332 (((menuCoords.x + menuCoords.w) > widgetCoords.x) && ((menuCoords.x + menuCoords.w) < (widgetCoords.x + widgetCoords.w))),
333 "begins or ends within the form widget horizontal boundaries");
334 doh.t(((menuCoords.y > widgetCoords.y) && (menuCoords.y < (widgetCoords.y + widgetCoords.h))) ||
335 (((menuCoords.y + menuCoords.h) > widgetCoords.y) && ((menuCoords.y + menuCoords.h) < (widgetCoords.y + widgetCoords.h))),
336 "begins or ends within the form widget vertical boundaries");
337
338 var cm = dom.byId("windowContextMenu");
339 doh.is("region", cm.parentNode.getAttribute("role"), "context menu's wrapper node needs role=region");
340 doh.is("windowContextMenu", cm.parentNode.getAttribute("aria-label"), "menu's wrapper node needs aria-label");
341 }), 1000);
342
343 return d;
344 }
345 },
346
347 {
348 name: "close form widget context menu (mouse)",
349 timeout: 4000,
350 runTest: function(){
351 var d = new doh.Deferred();
352
353 var menu = registry.byId("windowContextMenu");
354
355 // close menu from above test
356 robot.mouseMove(2, 2, 100);
357 robot.mouseClick({left: true}, 100);
358
359 robot.sequence(d.getTestCallback(function(){
360 doh.t(helpers.isHidden(menu), "menu should be hidden again");
361 }), 1000);
362
363 return d;
364 }
365 }
366 ]);
367
368 doh.register("Left click menu mouse test", {
369 name: "open left click context menu",
370 timeout: 5000,
371 runTest: function(){
372 var d = new doh.Deferred();
373
374 robot.mouseMoveAt("input2", 500, 1);
375 robot.mouseClick({left: true}, 500);
376
377 robot.sequence(d.getTestErrback(function(){
378 var menu = registry.byId("leftClickContextMenu");
379 doh.t(helpers.isVisible(menu), "menu is now shown");
380
381 // close menu
382 robot.mouseMove(2, 2, 100);
383 robot.mouseClick({left: true}, 100);
384
385 robot.sequence(d.getTestCallback(function(){
386 doh.t(helpers.isHidden(menu), "menu disappeared");
387 }), 1000);
388 }), 1000);
389
390 return d;
391 }
392 });
393
394 doh.register("More MenuBar mouse tests", [
395 {
396 name: "MenuBar selection and cancellation",
397 timeout: 15000,
398 runTest: function(){
399 var d = new doh.Deferred();
400
401 robot.mouseMoveAt("file", 500, 1000);
402 robot.mouseClick({left: true}, 500); // click File
403 robot.sequence(d.getTestErrback(function(){
404 doh.t(helpers.isVisible("fileMenu"), "File menu should be visible #1");
405 }), 1000);
406
407 robot.mouseClick({left: true}, 500); // close File menu
408 robot.mouseMoveAt("edit", 500, 500);
409
410 robot.sequence(d.getTestErrback(function(){
411 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden #1");
412 doh.t(helpers.isHidden("editMenu"), "Edit menu is hidden #1");
413
414 doh.f(domClass.contains("file", "dijitMenuItemSelected"),
415 "File MenuBarItem should not have selected class, actual class is: " + dom.byId("file").className);
416 doh.f(domClass.contains("file", "dijitMenuItemHover"),
417 "File MenuBarItem shouldn't have hover effect anymore, actual class is: " + dom.byId("edit").className);
418 doh.t(domClass.contains("edit", "dijitMenuItemHover"),
419 "Edit MenuBarItem should have hover effect, actual class is: " + dom.byId("edit").className);
420 }), 1000);
421
422 robot.mouseClick({left: true}, 500); // open edit menu
423 robot.mouseMoveAt("paste", 1000, 1);
424 robot.mouseClick({left: true}, 500); // click paste, closing edit menu
425 robot.mouseMoveAt("edit", 1000, 500);
426
427 robot.sequence(d.getTestErrback(function(){
428 doh.t(domClass.contains("edit", "dijitMenuItemHover"),
429 "Edit MenuBarItem should still have hover effect, actual class is: " + dom.byId("edit").className);
430 doh.t(helpers.isHidden("editMenu"), "edit menu disappeared #1");
431 }), 1000);
432
433 robot.mouseMoveAt("file", 500, 500);
434 robot.sequence(d.getTestErrback(function(){
435 doh.t(helpers.isHidden("fileMenu"), "File menu should be hidden #2");
436 }), 500);
437
438 robot.sequence(function(){
439 var
440 fileMenu = registry.byId("fileMenu"),
441 editMenu = registry.byId("editMenu"),
442 handler = fileMenu.on("open", function(){
443 handler.remove();
444 setTimeout(d.getTestErrback(function(){
445 doh.t(helpers.isVisible(fileMenu), "File menu should be visible #2");
446 handler = fileMenu.on("close", function(){
447 handler.remove();
448 setTimeout(d.getTestErrback(function(){
449 doh.t(helpers.isHidden(fileMenu), "File menu should be hidden #3");
450 handler = editMenu.on("open", function(){
451 handler.remove();
452 setTimeout(d.getTestErrback(function(){
453 doh.t(helpers.isVisible(editMenu), "Edit menu should be visible");
454 handler = editMenu.on("close",
455 function(){
456 handler.remove();
457 setTimeout(d.getTestCallback(function(){
458 doh.t(helpers.isHidden(editMenu), "Edit menu disappeared #2");
459 }), 150);
460 });
461 var paste = domGeom.position('paste');
462 robot._mouseMove(paste.x + (paste.w >> 1), paste.y + paste.h + 20, false, 1);
463 // click point on screen under the Edit menu
464 robot.mouseClick({left: true}, 100);
465 }), 150);
466 });
467 robot.mouseMoveAt("edit", 0, 1);
468 }), 150);
469 });
470 robot.mouseMoveAt("view", 0, 1); // #9846
471 }), 150);
472 });
473 }, 1);
474 robot.mouseClick({left: true}, 1); // click File that starts the event sequence above
475
476 return d;
477 }
478 },
479
480 {
481 name: "MenuBar navigation with BOTH mouse and keyboard",
482 timeout: 20000,
483 runTest: function(){
484 var d = new doh.Deferred();
485
486 // click random point on screen
487 robot.mouseMoveAt("link", 500, 500);
488 robot.mouseClick({left: true}, 500); // click link to focus it
489
490 robot.mouseMoveAt("view", 500, 500);
491 robot.sequence(d.getTestErrback(function(){
492 doh.t(domClass.contains("view", "dijitMenuItemHover"),
493 "View MenuBarItem should have hover effect, actual class is: " + dom.byId("view").className);
494 doh.t(helpers.isHidden("viewMenu"), "View menu is hidden");
495 }), 500);
496
497 // tab to the MenuBar... then focus should automatically shift to "File" menu,
498 robot.keyPress(keys.TAB, 500, {});
499 robot.sequence(d.getTestErrback(function(){
500 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden");
501 doh.t(domClass.contains("file", "dijitMenuItemSelected"),
502 "File MenuBarItem should have selected class, actual class is: " + dom.byId("file").className);
503 doh.f(domClass.contains("view", "dijitMenuItemHover"),
504 "View MenuBarItem shouldn't have hover effect anymore, actual class is: " + dom.byId("view").className);
505 }), 1000);
506
507 robot.mouseMoveAt("edit", 500, 500);
508 robot.sequence(d.getTestErrback(function(){
509 doh.t(domClass.contains("edit", "dijitMenuItemHover"),
510 "Edit MenuBarItem should have hover effect, actual class is: " + dom.byId("edit").className);
511 doh.t(helpers.isHidden("editMenu"), "View menu is hidden");
512 }), 500);
513
514 // Move to View item with keyboard. Focus should still on "File". Previously this test
515 // assumed that hovering "edit" would move focus there.
516 robot.keyPress(keys.RIGHT_ARROW, 1000, {});
517 robot.keyPress(keys.RIGHT_ARROW, 1000, {});
518 robot.sequence(d.getTestCallback(function(){
519 doh.t(helpers.isHidden("viewMenu"), "View menu is hidden");
520 doh.t(domClass.contains("view", "dijitMenuItemSelected"),
521 "View MenuBarItem should have selected class, actual class is: " + dom.byId("file").className);
522 doh.f(domClass.contains("edit", "dijitMenuItemHover"),
523 "Edit MenuBarItem shouldn't have hover effect anymore, actual class is: " + dom.byId("edit").className);
524 }), 1000);
525
526 return d;
527 }
528 }
529 ]);
530
531 doh.register("Menu diagonal movement tests", [
532 {
533 name: "Menu selection via sloppy movement",
534 timeout: 20000,
535 runTest: function(){
536 var d = new doh.Deferred();
537
538 robot.mouseMoveAt("navMenuPopupItem1", 500, 500); // move to Enabled submenu
539 robot.sequence(d.getTestErrback(function(){
540 doh.t(helpers.isHidden("navMenuSub1"), "Enabled submenu should be hidden");
541 }), 500);
542
543 robot.mouseClick({left: true}, 500); // click Enabled Submenu
544 robot.sequence(d.getTestErrback(function(){
545 doh.t(helpers.isVisible("navMenuSub1"), "Enabled submenu should be visible");
546 }), 1000);
547
548 robot.mouseMoveAt("navMenuDisabledItem", 500, 500);
549 robot.sequence(d.getTestErrback(function(){
550 doh.t(helpers.isHidden("navMenuSub1"), "Enabled submenu should be hidden");
551 }), 1000); // linger long enough for menu to close
552
553 robot.mouseMoveAt("navMenuPopupItem1", 500, 500); // move back to Enabled submenu
554 robot.sequence(d.getTestErrback(function(){
555 doh.t(helpers.isVisible("navMenuSub1"), "Enabled submenu should be visible");
556 }), 1000); // linger long enough for menu to open
557
558 robot.mouseMoveAt("navMenuDisabledItem", 500, 50); // QUICKLY move to the next menu item
559 robot.sequence(d.getTestErrback(function(){
560 }), 200, 50);
561
562 robot.mouseMoveAt("navMenuSub1_item2", 0, 50); // QUICKLY move to the popup menu
563 robot.sequence(d.getTestErrback(function(){
564 doh.t(helpers.isVisible("navMenuSub1"), "Enabled submenu 1 should be visible");
565 doh.t(domClass.contains("navMenuSub1_item2", "dijitMenuItemHover"),
566 "Submenu 1, item 2 navigation MenuItem should have hover effect, actual class is: " + dom.byId("navMenuDisabledItem").className);
567 doh.t(domClass.contains("navMenuPopupItem1", "dijitMenuItemSelected"),
568 "'Enabled Submenu' MenuItem should have selected effect, actual class is: " + dom.byId("navMenuPopupItem1").className);
569 var popup = domGeom.position('navMenuSub1_popup');
570 robot._mouseMove(popup.x + (popup.w >> 1), popup.y + popup.h + 20, false, 500);
571 }), 500, 1000);
572
573 robot.sequence(d.getTestErrback(function(){
574 doh.t(helpers.isVisible("navMenuSub1"), "Enabled submenu 1 menu still there");
575 }), 1000);
576
577 // click point on screen under the menu
578 robot.mouseClick({left: true}, 500);
579
580 robot.sequence(d.getTestCallback(function(){
581 doh.t(helpers.isHidden("navMenuSub1"), "Enabled submenu 1 menu disappeared");
582 }), 1000);
583
584 return d;
585 }
586 }
587 ]);
588
589 doh.register("passivePopupDelay", [
590 function setup(){
591 registry.byId("menubar").set("passivePopupDelay", 300);
592 },
593 {
594 name: "mouse over file MenuBarItem",
595 timeout: 4000,
596 runTest: function(){
597 var d = new doh.Deferred();
598
599 // Check initial conditions
600 doh.f(domClass.contains("file", "dijitMenuItemHover"), "File MenuBarItem doesn't have hover effect");
601 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden");
602
603 // Move over the File MenuBarItem
604 robot.mouseMoveAt("file", 500, 1000);
605
606 robot.sequence(d.getTestCallback(function(){
607 doh.t(helpers.isVisible("fileMenu"), "File menu is visible");
608 doh.f(domClass.contains("new", "dijitMenuItemSelected"),
609 "New MenuItem should not have selected class, actual class is: " + dom.byId("new").className);
610 }), 1000);
611
612 return d;
613 }
614 },
615
616 {
617 name: "hover edit menu item",
618 timeout: 4000,
619 runTest: function(){
620 var d = new doh.Deferred();
621
622 robot.mouseMoveAt("edit", 500, 500);
623
624 robot.sequence(d.getTestCallback(function(){
625 // Since we've already activated the MenuBar by clicking "File",
626 // hovering over "Edit" should automatically show the edit menu
627 doh.t(helpers.isVisible("editMenu"), "Edit menu is visible");
628
629 // And also, the file menu should have disappeared
630 doh.t(helpers.isHidden("fileMenu"), "File menu is hidden");
631 }), 500);
632
633 return d;
634 }
635 },
636
637
638 {
639 name: "close menu by click",
640 timeout: 4000,
641 runTest: function(){
642 var d = new doh.Deferred();
643
644 robot.mouseMoveAt("link", 500, 500);
645 robot.mouseClick({left: true}, 500);
646
647 robot.sequence(d.getTestCallback(function(){
648 doh.f(helpers.isVisible("editMenu"), "Edit menu is hidden");
649 }), 500);
650
651 return d;
652 }
653 }
654
655 ]);
656
657
658 doh.run();
659 });
660 </script>
661 </head>
662 </html>