summaryrefslogtreecommitdiffstatshomepage
path: root/includes/js/dijit/tests/test_Dialog_focusDestroy.html
blob: 187a5d4314ac6114006c46bb5db1869ed1ea3550 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
		"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>Dialog Widget Dojo Tests</title>

	<style type="text/css">
		@import "../../dojo/resources/dojo.css";
		@import "css/dijitTests.css";

		body { font-family : sans-serif; }
		form { margin-bottom : 0; }
		table { border: none; }
		#dialog3_underlay { background-color: #027 }
	</style>

	<script type="text/javascript"
		djConfig="parseOnLoad: true, isDebug: true"
		src="../../dojo/dojo.js"></script>
	<script type="text/javascript" src="_testCommon.js"></script>

	<script type="text/javascript">
		dojo.require("dijit.Dialog");
		dojo.require("dijit.form.Button");

		// make dojo.toJson() print dates correctly (this feels a bit dirty)
		function createAndShow() {
			var node = document.createElement("div");
			dojo.body().appendChild(node);
			var dlg = new dijit.Dialog({ title: "test input focus" }, node);

			var input = document.createElement("input");
			dojo.attr(input,"tabIndex","0");
			dlg.containerNode.appendChild(input);

			var btn = new dijit.form.Button({ label: "Close" });
			dlg.containerNode.appendChild(btn.domNode);

			dojo.connect(btn, "onClick", function(){
				console.log("destroying, while visible"); 
				dlg.destroy();
				
			});
			dlg.show();
		}
	</script>
</head>
<body>
<h1 class="testTitle">Dijit layout.Dialog tests</h1>

<p>If you input this box, you can type. You should be able to type and use backspace/etc
when you destroy the visible dialog. refs <a href="http://trac.dojotoolkit.org/ticket/5351">#5351</a>
</p>

<input id="testInput" name="foo" value="bar" />

<button dojoType="dijit.form.Button" onclick="createAndShow()">Show Dialog</button>

</body>
</html>