Files
openlayers/master/examples/Form_onsubmit.html
Éric Lemoine 5d14b9e2d4 Updated
2013-02-20 10:38:25 +01:00

216 lines
6.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Form_onsubmit Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"></script>
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_Form_onsubmit.html');
var textbox;
var handler;
doh.register("onsubmit", [
{
name: "submit1",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
textbox = dijit.byId("textbox");
//reset the submit textbox
textbox.set('value', "", false);
handler = textbox.connect(textbox, 'onChange', function(){
d.errback('onChange should not have fired');
});
doh.robot.mouseMoveAt("submit1", 1000, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("", textbox.get('value'));
}), 1000);
return d;
},
tearDown: function(){
textbox.disconnect(handler);
}
},
{
name: "submit2",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
//reset the submit textbox
textbox.set('value', "", false);
handler = textbox.connect(textbox, 'onChange', function(){
d.errback('onChange should not have fired');
});
doh.robot.mouseMoveAt("submit2", 0, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("", textbox.get('value'));
}), 1000);
return d;
},
tearDown: function(){
textbox.disconnect(handler);
}
},
{
name: "submit3",
timeout: 5000,
runTest: function(){
var d = new doh.Deferred();
//reset the submit textbox
textbox.set('value', "", false);
handler = textbox.connect(textbox, 'onChange',
d.getTestCallback(function(){
doh.is("one", textbox.get('value'));
})
);
doh.robot.mouseMoveAt("submit3", 0, 1);
doh.robot.mouseClick({left:true}, 500);
return d;
},
tearDown: function(){
textbox.disconnect(handler);
}
},
{
name: "submit4",
timeout: 5000,
runTest: function(){
var d = new doh.Deferred();
//reset the submit textbox
textbox.set('value', "", false);
handler = textbox.connect(textbox, 'onChange',
d.getTestCallback(function(){
doh.is("one", textbox.get('value'));
})
);
doh.robot.mouseMoveAt("submit4", 0, 1);
doh.robot.mouseClick({left:true}, 500);
return d;
},
tearDown: function(){
textbox.disconnect(handler);
}
},
{
name: "testReset1",
timeout: 9000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("combo1", 0, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.mouseMoveAt("reset1", 500, 0);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("two", dijit.byId("combo1").value);
}), 1000);
return d;
}
},
{
name: "testReset2",
timeout: 9000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("combo2", 0, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.mouseMoveAt("reset2", 500, 0);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("three", dijit.byId("combo2").value);
}), 1000);
return d;
}
},
{
name: "testReset3",
timeout: 9000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("combo3", 0, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.mouseMoveAt("reset3", 500, 0);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("one", dijit.byId("combo3").value);
}), 1000);
return d;
}
},
{
name: "testReset4",
timeout: 9000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("combo4", 0, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.mouseMoveAt("reset4", 500, 0);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("one", dijit.byId("combo4").value);
}), 1000);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>