Debian Codegraph @

dojox/app/tests/doh/lifecycleTest/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>Lifecycle and Controller Test</title>
7 <script type="text/javascript">
8 dojoConfig = {
9 parseOnLoad: false,
10 async:1,
11 app: {debugApp: 0} // set debugApp to log app transitions and view activate/deactivate
12 };
13 </script>
14 <script type="text/javascript" src="../../../../../dojo/dojo.js"></script>
15
16 <script>
17 // the actual launcher
18 require(["./modelApp.js"], function(){});
19 </script>
20 <script type="text/javascript">
21 require([
22 "doh/runner",
23 "dojo/topic",
24 "dojo/_base/lang",
25 "dojox/mobile/TransitionEvent",
26 "dojo/parser",
27 "dojo/when",
28 "dojox/app/controllers/Load",
29 "dojox/app/controllers/Transition",
30 "dojox/app/controllers/Layout",
31 "dojox/app/controllers/History"
32 ], function(doh, topic, lang, TransitionEvent, parser, when, Load, Transition, Layout, History) {
33 var events = [];
34 topic.subscribe("/app/status", lang.hitch(this, function(newStatus) {
35 events.push(newStatus);
36 if (newStatus == 2) {
37 doh.register("Test-LifeCycle App", [{
38 name : "test-LifeCycle",
39 runTest : function(t) {
40 var dfd = new doh.Deferred();
41 setTimeout(function() {
42 t.assertEqual([1, 2], events);
43 // test lifecycle methods are available
44 t.assertNotEqual(null, testApp.setStatus);
45 t.assertNotEqual(null, testApp.getStatus);
46 t.assertNotEqual(null, testApp.lifecycle);
47 return dfd.callback(true);
48 }, 500);
49 return dfd;
50 }
51 }, {
52 // Test controllers
53 name : "test-Controllers",
54 runTest : function(t) {
55 var dfd = new doh.Deferred();
56 setTimeout(function() {
57 // test controllers
58 t.assertEqual(4, testApp.controllers.length);
59 t.assertTrue(testApp.controllers[0] instanceof Load);
60 t.assertTrue(testApp.controllers[1] instanceof Transition);
61 t.assertTrue(testApp.controllers[2] instanceof Layout);
62 t.assertTrue(testApp.controllers[3] instanceof History);
63 return dfd.callback(true);
64 }, 500);
65 return dfd;
66 }
67 }]);
68
69 doh.run();
70 }
71 }));
72
73 });
74 </script>
75 </head>
76 <body>
77 </body>
78 </html>