Debian Codegraph @

dojox/app/tests/doh/globalizedApp/index.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
5 <meta name="apple-mobile-web-app-capable" content="yes" />
6 <title>Globalized Model App Test</title>
7 <link href="../../../../mobile/themes/iphone/base.css" rel="stylesheet">
8 <style>
9 html,body {
10 width: 100%;
11 height: 100%;
12 background: #eee;
13 font-family: arial;
14 color: #333;
15 overflow: hidden;
16 margin: 0;
17 padding: 0;
18 visibility: visible;
19 }
20
21 #splash {
22 width: 90%;
23 height: 90%;
24 margin: auto;
25 overflow: hidden;
26 border: 2px solid green;
27 color: #333;
28 text-align: center;
29 }
30
31 </style>
32 <script type="text/javascript">
33 dojoConfig = {
34 parseOnLoad: false,
35 mblHideAddressBar: false,
36 mblAndroidWorkaround: false,
37 mblAlwaysHideAddressBar: false,
38 async:1,
39 app: {debugApp: 0} // set debugApp to log app transitions and view activate/deactivate
40 };
41 </script>
42 <script type="text/javascript" src="../../../../../dojo/dojo.js"></script>
43
44 <script>
45 // the actual launcher
46 require(["../../globalizedApp/globalizedApp.js"], function(){});
47 </script>
48 <script type="text/javascript">
49 require([
50 "doh/runner",
51 "dojo/topic",
52 "dojo/_base/lang",
53 "dojo/dom",
54 "dojox/mobile/TransitionEvent",
55 "dijit/registry"
56 ], function(doh, topic, lang, dom, TransitionEvent, registry) {
57 var events = [];
58
59 var getLabelfromWid = function(wid, indx1, indx2){
60 var val = wid.labelNode.innerText || wid.labelNode.firstChild.nodeValue || "";
61 val = lang.trim(val);
62 if(indx2){
63 val = val.substring(indx1,indx2)
64 }
65 return val;
66 };
67
68 var getLabelfromDom = function(node, indx1, indx2){
69 var val = node.innerText || node.firstChild.nodeValue || "";
70 val = lang.trim(val);
71 if(indx2){
72 val = val.substring(indx1,indx2)
73 }
74 return val;
75 };
76
77 topic.subscribe("/app/status", lang.hitch(this, function(newStatus) {
78 events.push(newStatus);
79 if (newStatus == 2) {
80 var listItem_0TestStr = "Label Zero";
81 var listItem_1TestStr = "Label One";
82 doh.register("Test-GlobalizedApp", [{
83 // Test initial listitem labels
84 name : "initial-listItem-labels",
85 runTest : function() {
86 var dfd = new doh.Deferred();
87 setTimeout(function() {
88 var ListItem_0Label = registry.byId("dojox_mobile_ListItem_0");
89 if(ListItem_0Label){
90 var lab = getLabelfromWid(ListItem_0Label,0,listItem_0TestStr.length);
91 doh.is(lab, listItem_0TestStr);
92 }else{
93 throw new Error("In initial-listItem-labels ListItem_0Label not found.");
94 }
95 var ListItem_1Label = registry.byId("dojox_mobile_ListItem_1");
96 if(ListItem_1Label){
97 doh.is(getLabelfromWid(ListItem_1Label,0,listItem_1TestStr.length), listItem_1TestStr);
98 }else{
99 throw new Error("In initial-listItem-labels ListItem_1Label not found.");
100 }
101 return dfd.callback(true);
102 }, 500);
103 return dfd;
104 }
105 }, {
106 // Test first transition
107 name : "transition-test-1",
108 runTest : function() {
109 var dfd = new doh.Deferred();
110 setTimeout(function() {
111 // transition to first li
112 var liWidget = registry.byId("dojox_mobile_ListItem_2");
113 var ev = new TransitionEvent(liWidget.domNode, liWidget.params.transitionOptions);
114 ev.dispatch();
115 return dfd.callback(true);
116 }, 500);
117 }
118 }, {
119 // Test global data 1
120 name : "global-data-test-1",
121 timeout: 4000,
122 runTest : function() {
123 var dfd = new doh.Deferred();
124 setTimeout(function() {
125 var d = dom.byId("label");
126 if(d){
127 var globalOutput = "Home-foo";
128 var lab = getLabelfromDom(d,0,globalOutput.length);
129 doh.is(globalOutput, lab, "label should be of Home-foo");
130 }else{
131 throw new Error("In global-data-test-1 label should be of Home-foo.");
132 }
133 return dfd.callback(true);
134 }, 2000);
135 return dfd;
136 }
137 }, {
138 // Test back transition
139 name : "transition-back-1",
140 runTest : function() {
141 var dfd = new doh.Deferred();
142 if(history){
143 history.back();
144 setTimeout(function() {
145 doh.t(globalizedApp.children["globalizedApp_home"], "globalizedApp_home viewShowing should be true");
146 return dfd.callback(true);
147 }, 500);
148 }
149 }
150 }]);
151
152 doh.run();
153 }
154 }));
155
156 });
157 </script>
158 </head>
159 <body>
160 </body>
161 </html>