|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
|
4 <!-- |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id=792324 |
|
6 --> |
|
7 <window title="Mozilla Bug 792324" |
|
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
9 |
|
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
|
11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
|
12 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=792324">Mozilla Bug 792324</a> |
|
14 |
|
15 <p id="display"></p> |
|
16 <div id="content" style="display: none"> |
|
17 </div> |
|
18 </body> |
|
19 |
|
20 <panel id="panel-1"> |
|
21 <button label="just a normal button"/> |
|
22 <button id="button-1" |
|
23 accesskey="X" |
|
24 oncommand="clicked(event)" |
|
25 label="Button in panel 1" |
|
26 /> |
|
27 </panel> |
|
28 |
|
29 <panel id="panel-2"> |
|
30 <button label="just a normal button"/> |
|
31 <button id="button-2" |
|
32 accesskey="X" |
|
33 oncommand="clicked(event)" |
|
34 label="Button in panel 2" |
|
35 /> |
|
36 </panel> |
|
37 |
|
38 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[ |
|
39 |
|
40 /** Test for Bug 792324 **/ |
|
41 let after_click; |
|
42 |
|
43 function clicked(event) { |
|
44 after_click(event); |
|
45 } |
|
46 |
|
47 function checkAccessKeyOnPanel(panelid, buttonid, cb) { |
|
48 let panel = document.getElementById(panelid); |
|
49 panel.addEventListener("popupshown", function onpopupshown() { |
|
50 panel.removeEventListener("popupshown", onpopupshown); |
|
51 panel.firstChild.focus(); |
|
52 after_click = function(event) { |
|
53 is(event.target.id, buttonid, "Accesskey was directed to the button '" + buttonid + "'"); |
|
54 panel.hidePopup(); |
|
55 cb(); |
|
56 } |
|
57 synthesizeKey("X", {}); |
|
58 }); |
|
59 panel.openPopup(null, "", 100, 100, false, false); |
|
60 } |
|
61 |
|
62 function test() { |
|
63 checkAccessKeyOnPanel("panel-1", "button-1", function() { |
|
64 checkAccessKeyOnPanel("panel-2", "button-2", function() { |
|
65 SimpleTest.finish(); |
|
66 }); |
|
67 }); |
|
68 } |
|
69 |
|
70 SimpleTest.waitForExplicitFinish(); |
|
71 SimpleTest.waitForFocus(test, window); |
|
72 |
|
73 ]]></script> |
|
74 |
|
75 </window> |