aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dijit/tests/ondijitclick.html
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dijit/tests/ondijitclick.html
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dijit/tests/ondijitclick.html')
-rw-r--r--includes/js/dijit/tests/ondijitclick.html95
1 files changed, 95 insertions, 0 deletions
diff --git a/includes/js/dijit/tests/ondijitclick.html b/includes/js/dijit/tests/ondijitclick.html
new file mode 100644
index 0000000..36de0e0
--- /dev/null
+++ b/includes/js/dijit/tests/ondijitclick.html
@@ -0,0 +1,95 @@
+<!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, parseOnLoad: true"></script>
+ <script type="text/javascript">
+ dojo.require("doh.runner");
+ dojo.require("dijit._Widget");
+ dojo.require("dojo.parser");
+
+ dojo.declare("dijit.WidgetWithOndijitclick",
+ dijit._Widget,
+ {
+ clickCount: 0,
+ _onClick: function() {
+ this.clickCount++;
+ },
+ postCreate: function() {
+ this.connect(this.domNode, "ondijitclick", "_onClick");
+ }
+ }
+ );
+
+ dojo.addOnLoad(function(){
+ doh.register("ondijitclick",
+ [
+ {
+ name: "ondijitclick fires once on a space-key-up",
+ runTest: function(t){
+ var w = dijit.byId("widget1");
+ if (dojo.isSafari){ // safari has error
+ this.name += " * SKIPPED *";
+ return;
+ }
+
+ // simulate space up
+ if (document.createEvent){
+ var e = document.createEvent("KeyboardEvent");
+ e.initKeyEvent("keyup",true,true,null,false,false,false,false,32,0);
+ w.domNode.focus();
+ w.clickCount = 0;
+ w.domNode.dispatchEvent(e);
+ t.is(1, w.clickCount);
+ }
+ }
+ },
+ {
+ name: "ondijitclick fires once on an enter-key-down",
+ runTest: function(t){
+ var w = dijit.byId("widget1");
+ if (dojo.isSafari){ // safari has error
+ this.name += " * SKIPPED *";
+ return;
+ }
+
+ // simulate enter down
+ if (document.createEvent && !dojo.isSafari){
+ var e = document.createEvent("KeyboardEvent");
+ e.initKeyEvent("keydown",true,true,null,false,false,false,false,13,0);
+ w.domNode.focus();
+ w.clickCount = 0;
+ w.domNode.dispatchEvent(e);
+ t.is(1, w.clickCount);
+ }
+ }
+ },
+ {
+ name: "ondijitclick fires once on a mouse click",
+ runTest: function(t){
+ var w = dijit.byId("widget1");
+
+ // simulate enter up
+ if (document.createEvent){
+ var e = document.createEvent("MouseEvents");
+ e.initMouseEvent('click', true, true, document.defaultView, 1, 0, 0, 3, 3, false, false, false, false, 0, w.domNode);
+ w.clickCount = 0;
+ w.domNode.dispatchEvent(e);
+ t.is(1, w.clickCount);
+ }
+ }
+ }
+ ]
+ );
+ doh.run();
+ });
+
+ </script>
+</head>
+<body class="tundra">
+ <div id="widget1" dojoType="dijit.WidgetWithOndijitclick"></div>
+</body>
+</html>