toolkit/content/tests/chrome/test_bug792324.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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">
    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>
    15   <p id="display"></p>
    16 <div id="content" style="display: none">
    17 </div>
    18 </body>
    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>
    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>
    38 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
    40 /** Test for Bug 792324 **/
    41 let after_click;
    43 function clicked(event) {
    44   after_click(event);
    45 }
    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 }
    62 function test() {
    63   checkAccessKeyOnPanel("panel-1", "button-1", function() {
    64     checkAccessKeyOnPanel("panel-2", "button-2", function() {
    65       SimpleTest.finish();
    66     });
    67   });
    68 }
    70 SimpleTest.waitForExplicitFinish();
    71 SimpleTest.waitForFocus(test, window);
    73 ]]></script>
    75 </window>

mercurial