Debian Codegraph @

dijit/tests/robot/BgIframe.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 bgIframe Test</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/_base/array", "dojo/dom", "dojo/on", "dojo/sniff", "dojo/window",
18 "dijit/tests/helpers", "dojo/domReady!"
19 ], function(doh, robot, array, dom, on, has, winUtils, helpers){
20
21 robot.initRobot('../test_bgIframe.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 array.forEach(["pdf", "flash"], function(xId){
29 doh.register(xId, [
30 {
31 name: "dialog_" + xId,
32 timeout: 15000,
33 runTest: function(){
34 var d = new doh.Deferred();
35
36 winUtils.scrollIntoView(xId);
37
38 var wasClicked = false;
39 var connection;
40
41 // show the dialog; show it programmatically because we may have just scrolled the "show
42 // dialog" button off the screen)
43 registry.byId("dialog").show();
44
45 // drag the dialog on top of the pdf
46 robot.mouseMoveAt(registry.byId("dialog").titleNode, 2000, 1);
47 robot.mousePress({left: true}, 500);
48 robot.mouseMoveAt(xId, 500, 1000);
49 robot.mouseRelease({left: true}, 500);
50
51 robot.sequence(function(){
52 connection = on(registry.byId("dialog").containerNode, "click", function(e){ wasClicked = true; });
53 }, 500);
54
55 // click on the dialog
56 robot.mouseMoveAt(registry.byId("dialog").containerNode, 1, 1);
57 robot.mouseClick({left: true}, 500);
58
59 robot.sequence(d.getTestCallback(function(){
60 connection.remove();
61 // derify the native select did not disappear
62 doh.t(helpers.isVisible(dom.byId("dropDown_" + xId, robot.doc)), "The native select is not visible");
63
64 registry.byId("dialog").hide();
65
66 doh.t(wasClicked, "Dialog was not visible because the onclick did not fire.");
67 }), 1000);
68
69 return d;
70 }
71 },
72 {
73 name: "tooltip_" + xId,
74 timeout: 8000,
75 runTest: function(){
76 var d = new doh.Deferred();
77
78 var tooltipWasClicked = false;
79 var connection, oldHide;
80
81 // dhow the tooltip
82 robot.mouseMoveAt("two_" + xId, 500, 1);
83
84 robot.sequence(function(){
85 var tooltip = registry.byId("dijit__MasterTooltip_0");
86 oldHide = tooltip.hide;
87 tooltip.hide = function(aroundNode){
88 // don't allow the tooltip to be hidden
89 };
90 connection = on(tooltip.domNode, "click",
91 function(e){
92 tooltipWasClicked = true;
93 tooltip.hide = oldHide;
94 tooltip.hide(tooltip.aroundNode);
95 }
96 );
97 }, 2000);
98
99 // Click on the tooltip
100 robot.mouseMoveAt("dijit__MasterTooltip_0", 1, 1);
101 robot.mouseClick({left: true}, 500);
102
103 robot.sequence(d.getTestCallback(function(){
104 connection.remove();
105 doh.t(tooltipWasClicked, "The tooltip is not visible because the onclick event was not fired.");
106 }), 1000);
107
108 return d;
109 }
110 },
111 {
112 name: "dateTextBox_" + xId,
113 timeout: 7000,
114 runTest: function(){
115 var d = new doh.Deferred();
116
117 var wasClicked = false;
118 var connection;
119
120 // Show the popup
121 var textbox = registry.byId("dateText_" + xId);
122 robot.mouseMoveAt(textbox._buttonNode, 500, 1);
123 robot.mouseClick({left: true}, 500);
124
125 robot.sequence(function(){
126 connection = on(registry.byId("dateText_"+xId+"_popup").domNode, "click", function(e){ wasClicked = true; });
127 }, 2000);
128
129 // Click on the popup
130 robot.mouseMoveAt("dateText_"+xId+"_popup", 1, 1, 10, 10);
131 robot.mouseClick({left: true}, 500);
132
133 robot.sequence(d.getTestCallback(function(){
134 connection.remove();
135 doh.t(wasClicked);
136 }), 1000);
137
138 return d;
139 }
140 },
141 {
142 name: "menu_" + xId,
143 timeout: 7000,
144 runTest: function(){
145 var d = new doh.Deferred();
146
147 var wasClicked = false;
148 registry.byId("copy_"+xId).onClick = function(e){ wasClicked = true; };
149
150 // Show the popup
151 var button = registry.byId("menuButton_" + xId);
152 robot.mouseMoveAt(button.domNode, 500, 1);
153 robot.mouseClick({left: true}, 500);
154
155 // Click on the popup
156 robot.mouseMoveAt("copy_"+xId);
157 robot.mouseClick({left: true}, 500);
158
159 robot.sequence(d.getTestCallback(function(){
160 doh.t(wasClicked);
161 }), 1000);
162
163 return d;
164 }
165 }
166 ]);
167 });
168
169 doh.run();
170 });
171 </script>
172 </head>
173 </html>