dojox
Version:
Dojo eXtensions, a rollup of many useful sub-projects and varying states of maturity – from very stable and robust, to alpha and experimental. See individual projects contain README files for details.
164 lines (158 loc) • 7.11 kB
HTML
<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>Border Layout App</title>
<link type="text/css" href="../../borderLayoutApp/css/layoutApp.css" rel="stylesheet" />
<link id="themeStyles" rel="stylesheet" href="../../../../../dijit/themes/claro/claro.css"/>
<script type="text/javascript" src="../../../../../dojox/mobile/deviceTheme.js"></script>
<script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="parseOnLoad: false,
mblHideAddressBar: false,
mblAndroidWorkaround: false,
mblAlwaysHideAddressBar: false,
app: {debugApp: 0}, // set debugApp to log app transtions and view activate/deactivate
async: 1">
</script>
<script>
// the actual launcher
require(["../../borderLayoutApp/borderLayoutApp.js"], function(){});
</script>
<script type="text/javascript">
require([
"doh/runner",
"dojo/topic",
"dojo/_base/lang",
"dojo/dom",
"dojox/mobile/TransitionEvent",
"dijit/registry"
], function(doh, topic, lang, dom, TransitionEvent, registry) {
var events = [];
var getLabelfromWid = function(wid, indx1, indx2){
var val = wid.labelNode.innerText || wid.labelNode.firstChild.nodeValue || "";
val = lang.trim(val);
if(indx2){
val = val.substring(indx1,indx2)
}
return val;
};
topic.subscribe("/app/status", lang.hitch(this, function(newStatus) {
events.push(newStatus);
if (newStatus == 2) {
var listItem_0TestStr = "View 2+10+4+8+6";
var listItem_1TestStr = "View 1+9+3+7+5";
doh.register("Test-globalizedApp", [{
// Test initial listitem labels
name : "initial-listItem-labels",
timeout: 4000,
runTest : function() {
var dfd = new doh.Deferred();
setTimeout(function() {
var ListItem_0Label = registry.byId("dojox_mobile_ListItem_0");
if(ListItem_0Label){
var lab = getLabelfromWid(ListItem_0Label,0,listItem_0TestStr.length);
doh.is(lab, listItem_0TestStr);
}else{
throw new Error("In initial-listItem-labels ListItem_0Label not found.");
}
var ListItem_1Label = registry.byId("dojox_mobile_ListItem_1");
if(ListItem_1Label){
doh.is(getLabelfromWid(ListItem_1Label,0,listItem_1TestStr.length), listItem_1TestStr);
}else{
throw new Error("In initial-listItem-labels ListItem_1Label not found.");
}
if(borderLayoutApp.children["borderLayoutApp_view2"]){
doh.t(borderLayoutApp.children["borderLayoutApp_view2"], "borderLayoutApp_view2 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view10"], "borderLayoutApp_view10 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view4"], "borderLayoutApp_view4 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view8"], "borderLayoutApp_view8 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view6"], "borderLayoutApp_view6 viewShowing should be true");
}else{
throw new Error("borderLayoutApp_view2 not found.");
}
return dfd.callback(true);
}, 1000);
return dfd;
}
}, {
// Test first transition
name : "transition-test-1",
runTest : function() {
var dfd = new doh.Deferred();
setTimeout(function() {
// transition to first li
var liWidget = registry.byId("dojox_mobile_ListItem_1");
var ev = new TransitionEvent(liWidget.domNode, liWidget.params);
ev.dispatch();
return dfd.callback(true);
}, 500);
}
}, {
// Test globalized view 1
name : "borderLayoutApp-test-1",
timeout: 5000,
runTest : function() {
var dfd = new doh.Deferred();
setTimeout(function() {
if(borderLayoutApp.children["borderLayoutApp_view1"]){
doh.t(borderLayoutApp.children["borderLayoutApp_view1"].viewShowing, "borderLayoutApp_view1 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view9"].viewShowing, "borderLayoutApp_view9 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view3"].viewShowing, "borderLayoutApp_view3 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view7"].viewShowing, "borderLayoutApp_view7 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view5"].viewShowing, "borderLayoutApp_view5 viewShowing should be true");
}else{
throw new Error("borderLayoutApp_view1 not found.");
}
return dfd.callback(true);
}, 3000);
return dfd;
}
}, {
// Test second transition
name : "transition-test-2",
runTest : function() {
var dfd = new doh.Deferred();
setTimeout(function() {
var liWidget = registry.byId("dojox_mobile_ListItem_19");
var ev = new TransitionEvent(liWidget.domNode, liWidget.params);
ev.dispatch();
return dfd.callback(true);
}, 500);
}
}, {
// Test globalized view 2
name : "borderLayoutApp-test-2",
timeout: 5000,
runTest : function() {
var dfd = new doh.Deferred();
setTimeout(function() {
if(borderLayoutApp.children["borderLayoutApp_view2"]){
doh.t(borderLayoutApp.children["borderLayoutApp_view2"], "borderLayoutApp_view2 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view10"], "borderLayoutApp_view10 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view4"], "borderLayoutApp_view4 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view8"], "borderLayoutApp_view8 viewShowing should be true");
doh.t(borderLayoutApp.children["borderLayoutApp_view6"], "borderLayoutApp_view6 viewShowing should be true");
}else{
throw new Error("borderLayoutApp_view2 not found.");
}
if(history){
history.back();
setTimeout(function() {
history.back();
}, 500);
}
return dfd.callback(true);
}, 1000);
return dfd;
}
}]);
doh.run();
}
}));
});
</script>
</head>
<body>
<script type="dojo/require">at: "dojox/mvc/at"</script>
</body>
</html>