| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
<html> |
| 4 |
<head> |
| 5 |
<title>runner.robot Transitions Test</title> |
| 6 |
|
| 7 |
<style> |
| 8 |
@import "../../../../util/doh/robot/robot.css"; |
| 9 |
</style> |
| 10 |
|
| 11 |
|
| 12 |
<script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> |
| 13 |
|
| 14 |
<script language="JavaScript" type="text/javascript"> |
| 15 |
require([ |
| 16 |
"dojo/_base/kernel", |
| 17 |
"dojo/ready", // dojo.ready |
| 18 |
"doh/runner", //doh functions |
| 19 |
"dijit/registry", // dijit.registry.byId |
| 20 |
"dojo/_base/connect", |
| 21 |
"dijit/robotx" |
| 22 |
], function(kernel, ready, runner, registry, connect){ |
| 23 |
ready(function(){ |
| 24 |
|
| 25 |
runner.robot.initRobot("../test_transition-connect.html"); |
| 26 |
var reg = null; |
| 27 |
var seq = []; |
| 28 |
|
| 29 |
|
| 30 |
runner.register("dojox.mobile.Transitions", [ |
| 31 |
{ |
| 32 |
name: "slideIn", |
| 33 |
timeout: 50000, |
| 34 |
runTest: function(){ |
| 35 |
var d = new runner.Deferred(); |
| 36 |
reg = kernel.global.dijit.registry; |
| 37 |
|
| 38 |
connect.connect(reg.byId("view1"), "onBeforeTransitionOut", null, function(moveTo, dir, transition, context, method){ |
| 39 |
seq.push("onBeforeTransitionOut1,"+moveTo+","+dir+","+transition); |
| 40 |
}); |
| 41 |
connect.connect(reg.byId("view1"), "onBeforeTransitionIn", null, function(moveTo, dir, transition, context, method){ |
| 42 |
seq.push("onBeforeTransitionIn1,"+moveTo+","+dir+","+transition); |
| 43 |
}); |
| 44 |
connect.connect(reg.byId("view1"), "onAfterTransitionOut", null, function(moveTo, dir, transition, context, method){ |
| 45 |
seq.push("onAfterTransitionOut1,"+moveTo+","+dir+","+transition); |
| 46 |
}); |
| 47 |
connect.connect(reg.byId("view1"), "onAfterTransitionIn", null, function(moveTo, dir, transition, context, method){ |
| 48 |
seq.push("onAfterTransitionIn1,"+moveTo+","+dir+","+transition); |
| 49 |
}); |
| 50 |
|
| 51 |
connect.connect(reg.byId("view2"), "onBeforeTransitionOut", null, function(moveTo, dir, transition, context, method){ |
| 52 |
seq.push("onBeforeTransitionOut2,"+moveTo+","+dir+","+transition); |
| 53 |
}); |
| 54 |
connect.connect(reg.byId("view2"), "onBeforeTransitionIn", null, function(moveTo, dir, transition, context, method){ |
| 55 |
seq.push("onBeforeTransitionIn2,"+moveTo+","+dir+","+transition); |
| 56 |
}); |
| 57 |
connect.connect(reg.byId("view2"), "onAfterTransitionOut", null, function(moveTo, dir, transition, context, method){ |
| 58 |
seq.push("onAfterTransitionOut2,"+moveTo+","+dir+","+transition); |
| 59 |
}); |
| 60 |
connect.connect(reg.byId("view2"), "onAfterTransitionIn", null, function(moveTo, dir, transition, context, method){ |
| 61 |
seq.push("onAfterTransitionIn2,"+moveTo+","+dir+","+transition); |
| 62 |
}); |
| 63 |
|
| 64 |
runner.robot.mouseMoveAt(reg.byId("dojox_mobile_ListItem_0").domNode, 1000); |
| 65 |
runner.robot.mouseClick({left: true}, 500); |
| 66 |
|
| 67 |
runner.robot.sequence(d.getTestCallback(function(){ |
| 68 |
runner.assertEqual(["onBeforeTransitionOut1,view2,1,slide", |
| 69 |
"onBeforeTransitionIn2,view2,1,slide", |
| 70 |
"onAfterTransitionOut1,view2,1,slide", |
| 71 |
"onAfterTransitionIn2,view2,1,slide"], seq); |
| 72 |
}), 1500); |
| 73 |
return d; |
| 74 |
} |
| 75 |
}, |
| 76 |
{ |
| 77 |
name: "slideOut", |
| 78 |
timeout: 50000, |
| 79 |
runTest: function(){ |
| 80 |
var d = new runner.Deferred(); |
| 81 |
|
| 82 |
seq = []; |
| 83 |
|
| 84 |
runner.robot.mouseMoveAt(reg.byId("dojox_mobile_ToolBarButton_0").domNode, 1000); |
| 85 |
runner.robot.mouseClick({left: true}, 500); |
| 86 |
|
| 87 |
runner.robot.sequence(d.getTestCallback(function(){ |
| 88 |
runner.assertEqual(["onBeforeTransitionOut2,view1,-1,slide", |
| 89 |
"onBeforeTransitionIn1,view1,-1,slide", |
| 90 |
"onAfterTransitionOut2,view1,-1,slide", |
| 91 |
"onAfterTransitionIn1,view1,-1,slide"], seq); |
| 92 |
}), 1500); |
| 93 |
return d; |
| 94 |
} |
| 95 |
}, |
| 96 |
{ |
| 97 |
name: "flipIn", |
| 98 |
timeout: 50000, |
| 99 |
runTest: function(){ |
| 100 |
var d = new runner.Deferred(); |
| 101 |
|
| 102 |
seq = []; |
| 103 |
|
| 104 |
runner.robot.mouseMoveAt(reg.byId("dojox_mobile_ListItem_1").domNode, 1000); |
| 105 |
runner.robot.mouseClick({left: true}, 500); |
| 106 |
|
| 107 |
runner.robot.sequence(d.getTestCallback(function(){ |
| 108 |
runner.assertEqual(["onBeforeTransitionOut1,view2,1,flip", |
| 109 |
"onBeforeTransitionIn2,view2,1,flip", |
| 110 |
"onAfterTransitionOut1,view2,1,flip", |
| 111 |
"onAfterTransitionIn2,view2,1,flip"], seq); |
| 112 |
}), 1500); |
| 113 |
return d; |
| 114 |
} |
| 115 |
}, |
| 116 |
{ |
| 117 |
name: "slideOut2", |
| 118 |
timeout: 50000, |
| 119 |
runTest: function(){ |
| 120 |
var d = new runner.Deferred(); |
| 121 |
|
| 122 |
seq = []; |
| 123 |
|
| 124 |
runner.robot.mouseMoveAt(reg.byId("dojox_mobile_ToolBarButton_0").domNode, 1000); |
| 125 |
runner.robot.mouseClick({left: true}, 500); |
| 126 |
|
| 127 |
runner.robot.sequence(d.getTestCallback(function(){ |
| 128 |
runner.assertEqual(["onBeforeTransitionOut2,view1,-1,slide", |
| 129 |
"onBeforeTransitionIn1,view1,-1,slide", |
| 130 |
"onAfterTransitionOut2,view1,-1,slide", |
| 131 |
"onAfterTransitionIn1,view1,-1,slide"], seq); |
| 132 |
}), 1500); |
| 133 |
return d; |
| 134 |
} |
| 135 |
}, |
| 136 |
{ |
| 137 |
name: "fadeIn", |
| 138 |
timeout: 50000, |
| 139 |
runTest: function(){ |
| 140 |
var d = new runner.Deferred(); |
| 141 |
|
| 142 |
seq = []; |
| 143 |
|
| 144 |
runner.robot.mouseMoveAt(reg.byId("dojox_mobile_ListItem_2").domNode, 1000); |
| 145 |
runner.robot.mouseClick({left: true}, 500); |
| 146 |
|
| 147 |
runner.robot.sequence(d.getTestCallback(function(){ |
| 148 |
runner.assertEqual(["onBeforeTransitionOut1,view2,1,fade", |
| 149 |
"onBeforeTransitionIn2,view2,1,fade", |
| 150 |
"onAfterTransitionOut1,view2,1,fade", |
| 151 |
"onAfterTransitionIn2,view2,1,fade"], seq); |
| 152 |
}), 2000); |
| 153 |
return d; |
| 154 |
} |
| 155 |
}, |
| 156 |
{ |
| 157 |
name: "init", |
| 158 |
runTest: function(){ |
| 159 |
runner.assertEqual(true, kernel.global._testInitCallback); |
| 160 |
} |
| 161 |
} |
| 162 |
]); |
| 163 |
|
| 164 |
runner.run(); |
| 165 |
}); |
| 166 |
}); |
| 167 |
</script> |
| 168 |
</head> |
| 169 |
<body /> |
| 170 |
</html> |