Debian Codegraph @

dijit/tests/form/RadioButtonMixin.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
5 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
6 <title>_RadioButtonMixin tests</title>
7
8 <style type="text/css">
9 @import "../../themes/claro/document.css";
10 @import "../../themes/dijit.css";
11
12 #table {
13 margin: 0;
14 padding: 2px;
15 }
16 #table, .dijit, BUTTON {
17 font-family: monospace;
18 font-size: 12pt;
19 }
20 #table .layout {
21 padding: 2px;
22 font-size: 100%;
23 margin: 0;
24 }
25 </style>
26 <link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/>
27
28 <script type="text/javascript" src="../../../dojo/dojo.js"
29 data-dojo-config="parseOnLoad: true, isDebug: true"></script>
30
31 <script type="text/javascript">
32 dojo.require("doh.runner");
33 dojo.require("dijit.dijit"); // optimize: load dijit layer
34 dojo.require("dijit.form.RadioButton");
35 dojo.require("dojox.mobile.RadioButton");
36
37 dojo.ready(function(){
38
39 doh.register("attributes", [
40 {
41 name: "dijit",
42 runTest: function(){
43 var dijit_attributes = dijit.byId('dijit_attributes');
44 doh.is("something", dijit_attributes.focusNode.value, 'dijit HTML element original value');
45 doh.t(dijit_attributes.get('checked'), "dijit original get('checked')");
46 doh.t(!!dijit_attributes.focusNode.checked, 'dijit HTML element originally checked');
47 doh.t(dojo.hasClass(dijit_attributes.domNode, dijit_attributes.baseClass+"Checked"), "dijit baseClass checked");
48 dijit_attributes.set('value', "something else");
49 dijit.byId('dijit_attributes2').set('checked', true);
50 doh.f(dijit_attributes.get('checked'), "dijit get('checked')");
51 doh.t(!dijit_attributes.focusNode.checked, 'dijit HTML element unchecked');
52 doh.f(dojo.hasClass(dijit_attributes.domNode, dijit_attributes.baseClass+"Checked"), "dijit baseClass not checked");
53 doh.t(dojo.hasClass(dijit_attributes.domNode, dijit_attributes.baseClass), "dijit baseClass");
54 doh.t(dojo.hasClass(dijit_attributes.domNode, "mblRedButton"), "dijit original class");
55 doh.is("something else", dijit_attributes.focusNode.value, 'dijit HTML element value');
56 }
57 },
58 {
59 name: "mobile",
60 runTest: function(){
61 var mobile_attributes = dijit.byId('mobile_attributes');
62 doh.is("something", mobile_attributes.focusNode.value, 'mobile HTML element original value');
63 doh.t(mobile_attributes.get('checked'), "mobile original get('checked')");
64 doh.t(!!mobile_attributes.focusNode.checked, 'mobile HTML element originally checked');
65 doh.t(dojo.hasClass(mobile_attributes.domNode, mobile_attributes.baseClass+"Checked"), "mobile baseClass checked");
66 dijit.byId('mobile_attributes2').set('checked', true);
67 mobile_attributes.set('value', "something else");
68 doh.f(mobile_attributes.get('checked'), "mobile get('checked')");
69 doh.t(!mobile_attributes.focusNode.checked, 'mobile HTML element unchecked');
70 doh.f(dojo.hasClass(mobile_attributes.domNode, mobile_attributes.baseClass+"Checked"), "mobile baseClass not checked");
71 doh.t(dojo.hasClass(mobile_attributes.domNode, mobile_attributes.baseClass), "mobile baseClass");
72 doh.t(dojo.hasClass(mobile_attributes.domNode, "mblRedButton"), "mobile original class");
73 doh.is("something else", mobile_attributes.focusNode.value, 'mobile HTML element value');
74 }
75 }
76 ]);
77
78 doh.register("events", [
79 {
80 name: "dijit",
81 timeout: 5000,
82 runTest: function(){
83 var
84 d = new doh.Deferred(),
85 dijit_events = dijit.byId('dijit_events'),
86 calledOnClick = false,
87 nop = function(){ return false; };
88
89 function onChange(v){
90 dijit_events.set('onChange', nop);
91 d.callback(true);
92 }
93 dijit_events.set('onChange', onChange);
94 dijit_events._onClick({ preventDefault: nop });
95
96 return d;
97 }
98 },
99 {
100 name: "mobile",
101 timeout: 5000,
102 runTest: function(){
103 var
104 d = new doh.Deferred(),
105 mobile_events = dijit.byId('mobile_events'),
106 nop = function(){ return false; };
107
108 function onChange(){
109 mobile_events.set('onChange', nop);
110 d.callback(true);
111 }
112 mobile_events.set("onChange", onChange);
113 setTimeout(function(){ mobile_events.focusNode.click({ preventDefault: nop }); }, 0);
114
115 return d;
116 }
117 }
118 ]);
119
120 doh.register("programmatic", [
121 {
122 name: "dijit",
123 timeout: 5000,
124 runTest: function(){
125 new dijit.form.RadioButton({name:"dijit_programmatic", id:"dijit_programmatic", checked:true, "aria-label":"dijit_programmatic"}).placeAt("dijit_programmatic_container", "first");
126 var dijit_programmatic = dijit.byId('dijit_programmatic');
127 var pos = dojo.position(dijit_programmatic.domNode, true);
128 doh.t(pos.w > 0 && pos.h > 0 && pos.x > 0 && pos.y > 0, 'dijit position');
129 doh.t(dijit_programmatic.get('checked'), 'dijit widget checked');
130 doh.t(!!dijit_programmatic.focusNode.checked, 'dijit HTML element checked');
131 }
132 },
133 {
134 name: "mobile",
135 timeout: 5000,
136 runTest: function(){
137 new dojox.mobile.RadioButton({name:"mobile_programmatic", id:"mobile_programmatic", checked:true, "aria-label":"mobile_programmatic"}).placeAt("mobile_programmatic_container", "first");
138 var mobile_programmatic = dijit.byId('mobile_programmatic');
139 if(dojo.isIE < 8){ // older IE ignores setting checked after creation but before appending to the DOM
140 dojo.attr(mobile_programmatic.focusNode, "checked", mobile_programmatic.checked);
141 }
142 var pos = dojo.position(mobile_programmatic.domNode, true);
143 doh.t(pos.w > 0 && pos.h > 0 && pos.x > 0 && pos.y > 0, 'mobile position');
144 doh.t(!!mobile_programmatic.focusNode.checked, 'mobile HTML element checked');
145 doh.t(mobile_programmatic.get('checked'), 'mobile widget checked');
146 }
147 }
148 ]);
149
150 doh.run();
151 });
152 </script>
153 </head>
154 <body class="claro" role="main">
155 <h1 class="testTitle">_RadioButtonMixin (dijit and mobile) non-robot tests</h1>
156
157 <table id="table">
158 <tr>
159 <th class="layout">&nbsp;</th>
160 <th class="layout" colspan=2>dijit</th>
161 <th class="layout" colspan=2>mobile</th>
162 </tr>
163 <tr>
164 <td class="layout">attributes</td>
165 <td class="layout"><input name="dijit_attributes" id="dijit_attributes" data-dojo-type="dijit/form/RadioButton" data-dojo-props='checked: true, "class":"mblRedButton", value:"something", name:"dijit_attributes", "aria-label":"dijit_attributes" '/></td>
166 <td class="layout"><input name="dijit_attributes" aria-label="dijit_attributes2" id="dijit_attributes2" type="radio" value="other" dojoType="dijit.form.RadioButton">
167 <td class="layout"><input name="mobile_attributes" aria-label="mobile_attributes" type="radio" value="something" class="mblRedButton" checked id="mobile_attributes" dojoType="dojox.mobile.RadioButton"/></td>
168 <td class="layout"><input name="mobile_attributes" aria-label="mobile_attributes2" id="mobile_attributes2" type="radio" value="other" dojoType="dojox.mobile.RadioButton">
169 </tr>
170 <tr>
171 <tr>
172 <td class="layout">Events</td>
173 <td class="layout"><input name="dijit_events" id="dijit_events" data-dojo-type="dijit/form/RadioButton" data-dojo-props='onClick:function(){ return true; }, name:"dijit_events", "aria-label":"dijit_events"' /></td>
174 <td class="layout"><input name="dijit_events" aria-label="dijit_events2" type="radio" value="other" dojoType="dijit.form.RadioButton">
175 <td class="layout"><input name="mobile_events" aria-label="mobile_events" type="radio" id="mobile_events" data-dojo-type="dojox.mobile.RadioButton" data-dojo-props='onClick:function(){ return true; }' /></td>
176 <td class="layout"><input name="mobile_events" aria-label="mobile_events2" type="radio" value="other" dojoType="dojox.mobile.RadioButton">
177 </tr>
178 <tr>
179 <td class="layout">Programmatic</td>
180 <td class="layout" id="dijit_programmatic_container"></td>
181 <td class="layout"><input name="dijit_programmatic" type="radio" aria-label="dijit_programmatic" value="other" dojoType="dijit.form.RadioButton">
182 <td class="layout" id="mobile_programmatic_container"></td>
183 <td class="layout"><input name="mobile_programmatic" type="radio" aria-label="mobile_programmatic" value="other" dojoType="dojox.mobile.RadioButton">
184 </tr>
185 </table>
186 </body>
187 </html>