Debian Codegraph @

dijit/tests/_Widget-ondijitclick.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4
5 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
6
7 <title>Test Dijit Internal Event: "ondijitclick"</title>
8
9 <style>
10 div {
11 border: 1px solid blue;
12 margin: 1em;
13 }
14 </style>
15
16 <script type="text/javascript" src="../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
17 <script type="text/javascript">
18 dojo.require("dijit._WidgetBase");
19 dojo.require("dijit._OnDijitClickMixin");
20 dojo.require("dojo.parser");
21
22 dojo.ready(function(){
23 dojo.declare("WidgetWithOndijitclick", [dijit._WidgetBase, dijit._OnDijitClickMixin], {
24 clickCount: 0,
25 onClick: function(){
26 },
27 _onClick: function(evt){
28 this.clickCount++;
29 this.onClick(evt);
30 },
31 postCreate: function(){
32 this.connect(this.domNode, "ondijitclick", "_onClick");
33 }
34 });
35
36 dojo.parser.parse();
37 });
38 </script>
39 </head>
40 <body class="claro">
41 <h1>_Widget.ondijitclick test</h1>
42 <p>
43 This tests dijit's infrastructure for catching SPACE and ENTER key clicks on nodes
44 that aren't &lt;button&gt; or &lt;a&gt;, and therefore don't normally respond to keyboard
45 "click events".
46 </p>
47 <p>
48 Clicking the first widget moves focus to the plain button,
49 but that button itself shouldn't get a click event. (There are some subtleties about
50 whether catch clicks on key-down or key-up so this tests to make sure we are doing
51 the right one.)
52 </p>
53 <div id="first" tabIndex="0" data-dojo-type="WidgetWithOndijitclick" data-dojo-props='
54 onClick:function(){ dojo.byId("plainbutton").focus(); }'>
55 click me using space or enter, to focus button below
56 </div>
57 <button id="plainbutton" onclick="console.log('plain button clicked'); window.clicked = true;" type="button" >plain button</button>
58
59 <div id="second" tabIndex="0" data-dojo-type="WidgetWithOndijitclick" data-dojo-props='
60 onClick:function(){ dojo.byId("textarea").focus(); }'>
61 click me using space or enter, to focus textarea below
62 </div>
63 <textarea id="textarea">hello world</textarea>
64
65 <br>
66 <button id="plainbutton2" style="margin-top: 2em;" type="button"
67 onClick="dojo.byId('third').focus();">
68 click me using space or enter, to focus ondijitclick widget below
69 </button>
70 <div id="third" tabIndex="0" data-dojo-type="WidgetWithOndijitclick" data-dojo-props='style:"margin-top: 0px;",
71 onFocus:function(){ console.log("onfocus on third"); window.onDijitClickFocus = true; },
72 onClick:function(){ console.log("onclick on third"); window.spuriousOnDijitClick = true; }'>
73 clicking the button above shouldn't cause my ondijitclick handler to fire
74 </div>
75 <br>
76 <div id="fourth" tabIndex="0" data-dojo-type="WidgetWithOndijitclick" data-dojo-props='style:"margin-top: 0px;",
77 onClick:function(){ alert("make sure can close this alert via keyboard"); }'>
78 Manual Test: Click me using space or enter to launch a JavaScript alert() from element using ondijitclick
79 </div>
80 <br>
81 Clicking this button should produce exactly one click event to console:
82 <button id="widgetbutton" tabIndex="0" data-dojo-type="WidgetWithOndijitclick">
83 button w/ondijitclick
84 </button>
85
86 <div id="outer">
87 Test for bubble of click
88 <div id="inner">
89 <span data-dojo-type="WidgetWithOndijitclick" id="bubbleTestWidget" tabindex="0">click me</span>
90 <span data-dojo-type="WidgetWithOndijitclick" id="bubbleTestWidget2" tabindex="0">click me too</span>
91 </div>
92 </div>
93 </body>
94 </html>