blob: 924ffcf1ca351683c8073eaef6e46c2b7010ea2d (
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
|
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1322947
-->
<head>
<title>Test for Bug 1322947</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="SimpleTest.waitForFocus(runTest)">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1322947"> Test dialog modal is closed by escape key</a>
<p id="display"></p>
<dialog id="dialog">
<select>
<option value="one">one</option>
<option value="two">two</option>
</select>
</dialog>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
function runTest() {
const dialog = document.getElementById("dialog");
const select = document.querySelector("select");
dialog.addEventListener("close", function() {
ok(dialog.close, "dialog with select is closed");
done();
});
dialog.showModal();
ok(select == document.activeElement, "select element should be focused");
synthesizeKey("VK_ESCAPE", {}, window);
}
function done() {
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>
|