aboutsummaryrefslogtreecommitdiffstats
path: root/tests/visual/dialog/complex-dialogs.html
blob: 78e93be985c5f24bcf5751c78ca052b78a5cd676 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Dialog Visual Test</title>
	<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
	<script src="../../../jquery-1.9.1.js"></script>
	<script src="../../../ui/jquery.ui.core.js"></script>
	<script src="../../../ui/jquery.ui.widget.js"></script>
	<script src="../../../ui/jquery.ui.mouse.js"></script>
	<script src="../../../ui/jquery.ui.draggable.js"></script>
	<script src="../../../ui/jquery.ui.position.js"></script>
	<script src="../../../ui/jquery.ui.resizable.js"></script>
	<script src="../../../ui/jquery.ui.button.js"></script>
	<script src="../../../ui/jquery.ui.dialog.js"></script>

	<!-- stuff needed to make things complex -->
	<script src="../../../ui/jquery.ui.datepicker.js"></script>
	<script src="../../../ui/jquery.ui.menu.js"></script>
	<script src="../../../ui/jquery.ui.autocomplete.js"></script>
	<script src="../../../ui/jquery.ui.tooltip.js"></script>

	<style>
	body {
		font-size: 62.5%;
	}
	</style>
	<script>
	$(function() {
		var dialog = $( "#dialog" ).dialog({
				modal: true,
				width: 500,
				buttons: [
					{
						click: $.noop,
						icons: {
							primary: "ui-icon-check"
						},
						text: "Ok"
					},
					{
						click: function() {
							$( this ).dialog( "close" );
						},
						icons: {
							primary: "ui-icon-cancel"
						},
						text: "Cancel",
						showText: false
					}
				]
			}).dialog("option", "height", 600),

			datepickerDialog = $( "#dialog-datepicker" ).dialog({
				autoOpen: false,
				modal: true
			}),

			autocompleteDialog = $( "#dialog-autocomplete" ).dialog({
				autoOpen: false,
				modal: false,
				width: 600
			});

		$( "#open-dialog" ).click(function() {
			dialog.dialog( "open" );
		});

		$( "#open-datepicker" ).click(function() {
			datepickerDialog.dialog( "open" );
		});

		$( "#open-autocomplete" ).click(function() {
			autocompleteDialog.dialog( "open" );
		});

		$( "#datepicker" ).datepicker();

		$( "#autocomplete" ).autocomplete({
			source: [
				"ActionScript",
				"AppleScript",
				"Asp",
				"BASIC",
				"Scheme"
			]
		});

		$( "#destroy-dialog" ).click(function() {
			dialog.dialog( "destroy" ).show();
			$( this ).remove();
		});

		$( document ).tooltip();
	});
	</script>
</head>
<body>

<p>WHAT: A modal dialog opening another modal dialog (including a datepicker), opening a non-modal dialog (including an autocomplete with tooltip applied). A regular link on the page, outside of the dialogs.</p>
<p>EXPECTED: As long as a modal dialog is open, focus stays within the dialogs. Both mouse and keyboard interactions are captured and restricted to the dialog. When the nested modal dialog is open, the first modal dialog can't be interacted with, until the nested dialog is closed. When the third dialog is open (not modal), switching between the two dialogs is possible, both can be interacted with.</p>


<button id="open-dialog">Reopen dialog</button>

<div id="dialog" title="Basic dialog, but with a really long title that doesn't quite fit.">
	<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
	<p><button id="open-datepicker">Open another window with a datepicker.</button></p>
	<p><button id="destroy-dialog">Self destruct</button></p>
</div>

<div id="dialog-datepicker" title="A dialog with a datepicker">
	<p>Date: <input id="datepicker"></p>
	<p><button id="open-autocomplete" autofocus>Open another window with an autocomplete and a tooltip.</button></p>
</div>

<div id="dialog-autocomplete">
	<label for="autocomplete">Tags: </label>
	<input id="autocomplete" title="Try typing something!">
</div>

<a href="#">Outside link</a>

</body>
</html>