Updated
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<title>Test Dijit Internal Event: "ondijitclick"</title>
|
||||
|
||||
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
|
||||
<script type="text/javascript">
|
||||
dojo.require("dijit.robotx");
|
||||
|
||||
dojo.ready(function(){
|
||||
doh.robot.initRobot('../_Widget-ondijitclick.html');
|
||||
|
||||
// Event monitoring
|
||||
var widgetClicks = 0, buttonClicks = 0;
|
||||
var w;
|
||||
|
||||
doh.register("ondijitclick w/mouse", {
|
||||
timeout:5000,
|
||||
runTest:function(){
|
||||
var d = new doh.Deferred();
|
||||
|
||||
doh.robot.sequence(function(){
|
||||
w = dijit.byId("first");
|
||||
dojo.connect(w, "_onClick", function(){
|
||||
widgetClicks++;
|
||||
}),
|
||||
dojo.connect(dojo.byId("plainbutton"), "onclick", function(){
|
||||
buttonClicks++;
|
||||
});
|
||||
w.domNode.focus();
|
||||
}, 100);
|
||||
|
||||
// click the widget
|
||||
doh.robot.mouseMoveAt("first", 500);
|
||||
doh.robot.mouseClick({left: true}, 500);
|
||||
|
||||
doh.robot.sequence(d.getTestCallback(function(){
|
||||
doh.is(1, widgetClicks, "ondijitclick handler fired once");
|
||||
}), 1000);
|
||||
|
||||
return d;
|
||||
}
|
||||
});
|
||||
|
||||
// Test clicking on a <button> with an ondijitclick handler.
|
||||
doh.register("click ondijitclick button", [
|
||||
{
|
||||
name: "click",
|
||||
timeout: 5000,
|
||||
runTest: function(){
|
||||
|
||||
var d = new doh.Deferred(),
|
||||
buttonWidget = dijit.byId("widgetbutton");
|
||||
|
||||
buttonWidget.clickCount = 0;
|
||||
|
||||
doh.robot.mouseMoveAt("widgetbutton", 500);
|
||||
doh.robot.mouseClick({left: true}, 500);
|
||||
|
||||
// Check that ondijitclick fired exactly once
|
||||
doh.robot.sequence(d.getTestCallback(function(){
|
||||
doh.is(1, buttonWidget.clickCount, "one click event");
|
||||
}), 500);
|
||||
|
||||
return d;
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
doh.run();
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
Reference in New Issue
Block a user