sample skeleton application with dojo toolkit & arcgis js api v 4.30
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

78 lines
2.5 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Lifecycle and Controller Test</title>
<script type="text/javascript">
dojoConfig = {
parseOnLoad: false,
async:1,
app: {debugApp: 0} // set debugApp to log app transitions and view activate/deactivate
};
</script>
<script type="text/javascript" src="../../../../../dojo/dojo.js"></script>
<script>
// the actual launcher
require(["./modelApp.js"], function(){});
</script>
<script type="text/javascript">
require([
"doh/runner",
"dojo/topic",
"dojo/_base/lang",
"dojox/mobile/TransitionEvent",
"dojo/parser",
"dojo/when",
"dojox/app/controllers/Load",
"dojox/app/controllers/Transition",
"dojox/app/controllers/Layout",
"dojox/app/controllers/History"
], function(doh, topic, lang, TransitionEvent, parser, when, Load, Transition, Layout, History) {
var events = [];
topic.subscribe("/app/status", lang.hitch(this, function(newStatus) {
events.push(newStatus);
if (newStatus == 2) {
doh.register("Test-LifeCycle App", [{
name : "test-LifeCycle",
runTest : function(t) {
var dfd = new doh.Deferred();
setTimeout(function() {
t.assertEqual([1, 2], events);
// test lifecycle methods are available
t.assertNotEqual(null, testApp.setStatus);
t.assertNotEqual(null, testApp.getStatus);
t.assertNotEqual(null, testApp.lifecycle);
return dfd.callback(true);
}, 500);
return dfd;
}
}, {
// Test controllers
name : "test-Controllers",
runTest : function(t) {
var dfd = new doh.Deferred();
setTimeout(function() {
// test controllers
t.assertEqual(4, testApp.controllers.length);
t.assertTrue(testApp.controllers[0] instanceof Load);
t.assertTrue(testApp.controllers[1] instanceof Transition);
t.assertTrue(testApp.controllers[2] instanceof Layout);
t.assertTrue(testApp.controllers[3] instanceof History);
return dfd.callback(true);
}, 500);
return dfd;
}
}]);
doh.run();
}
}));
});
</script>
</head>
<body>
</body>
</html>