accessible/tests/mochitest/relations/test_ui_modalprompt.html

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:ef0ad60f171f
1 <html>
2
3 <head>
4 <title>Modal prompts</title>
5 <link rel="stylesheet" type="text/css"
6 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
7
8 <script type="application/javascript"
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10 <script type="application/javascript"
11 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
12
13 <script type="application/javascript"
14 src="../common.js"></script>
15 <script type="application/javascript"
16 src="../relations.js"></script>
17 <script type="application/javascript"
18 src="../role.js"></script>
19 <script type="application/javascript"
20 src="../events.js"></script>
21 <script type="application/javascript"
22 src="../browser.js"></script>
23
24 <script type="application/javascript">
25 function hasTabModalPrompts() {
26 try {
27 return SpecialPowers.getBoolPref("prompts.tab_modal.enabled");
28 } catch (ex) {
29 return false;
30 }
31 }
32
33 function showAlert()
34 {
35 this.eventSeq = [
36 {
37 type: EVENT_SHOW,
38 match: function(aEvent)
39 {
40 return aEvent.accessible.role == ROLE_DIALOG;
41 }
42 }
43 ];
44
45 this.invoke = function showAlert_invoke()
46 {
47 window.setTimeout(
48 function()
49 {
50 currentTabDocument().defaultView.alert("hello");
51 }, 0);
52 }
53
54 this.check = function showAlert_finalCheck(aEvent)
55 {
56 var dialog = aEvent.accessible.DOMNode;
57 var info = dialog.ui.infoBody;
58 testRelation(info, RELATION_DESCRIPTION_FOR, dialog);
59 testRelation(dialog, RELATION_DESCRIBED_BY, info);
60 }
61
62 this.getID = function showAlert_getID()
63 {
64 return "show alert";
65 }
66 }
67
68 //gA11yEventDumpToConsole = true; // debug
69
70 var gQueue = null;
71 function doTests()
72 {
73 gQueue = new eventQueue();
74 gQueue.push(new showAlert());
75 gQueue.onFinish = function()
76 {
77 synthesizeKey("VK_RETURN", {}, browserWindow());
78 closeBrowserWindow();
79 }
80 gQueue.invoke(); // will call SimpleTest.finish()
81 }
82
83 if (!hasTabModalPrompts()) {
84 todo(false, "Test disabled when tab modal prompts are not enabled.");
85 } else {
86 SimpleTest.waitForExplicitFinish();
87 openBrowserWindow(doTests);
88 }
89 </script>
90
91 </head>
92
93 <body id="body">
94
95 <a target="_blank"
96 href="https://bugzilla.mozilla.org/show_bug.cgi?id=661293"
97 title="The tabmodalprompt dialog's prompt label doesn't get the text properly associated for accessibility">
98 Mozilla Bug 661293
99 </a>
100 <br>
101 <p id="display"></p>
102 <div id="content" style="display: none"></div>
103 <pre id="test">
104 </pre>
105
106 </body>
107 </html>

mercurial