tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_popupNotification_accesskey.js (1317B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 function test() {
      6  waitForExplicitFinish();
      7 
      8  ok(PopupNotifications, "PopupNotifications object exists");
      9  ok(PopupNotifications.panel, "PopupNotifications panel exists");
     10 
     11  setup();
     12 }
     13 
     14 let buttonPressed = false;
     15 
     16 function commandTriggered() {
     17  buttonPressed = true;
     18 }
     19 
     20 var tests = [
     21  // This test ensures that the accesskey closes the popup.
     22  {
     23    id: "Test#1",
     24    run() {
     25      this.notifyObj = new BasicNotification(this.id);
     26      showNotification(this.notifyObj);
     27    },
     28    onShown(popup) {
     29      window.addEventListener("command", commandTriggered, true);
     30      checkPopup(popup, this.notifyObj);
     31      EventUtils.synthesizeKey("VK_ALT", { type: "keydown" });
     32      EventUtils.synthesizeKey("M", { altKey: true });
     33      EventUtils.synthesizeKey("VK_ALT", { type: "keyup" });
     34 
     35      // If bug xxx was present, then the popup would be in the
     36      // process of being hidden right now.
     37      isnot(popup.state, "hiding", "popup is not hiding");
     38    },
     39    onHidden() {
     40      window.removeEventListener("command", commandTriggered, true);
     41      ok(buttonPressed, "button pressed");
     42    },
     43  },
     44 ];