tor-browser

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

browser_popupNotification_learnmore.js (1829B)


      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 var tests = [
     15  // Test checkbox being checked by default
     16  {
     17    id: "without_learn_more",
     18    run() {
     19      this.notifyObj = new BasicNotification(this.id);
     20      showNotification(this.notifyObj);
     21    },
     22    onShown(popup) {
     23      checkPopup(popup, this.notifyObj);
     24      let notification = popup.children[0];
     25      let link = notification.querySelector(
     26        ".popup-notification-learnmore-link"
     27      );
     28      ok(!link.href, "no href");
     29      is(
     30        window.getComputedStyle(link).getPropertyValue("display"),
     31        "none",
     32        "link hidden"
     33      );
     34      dismissNotification(popup);
     35    },
     36    onHidden() {},
     37  },
     38 
     39  // Test that passing the learnMoreURL field sets up the link.
     40  {
     41    id: "with_learn_more",
     42    run() {
     43      this.notifyObj = new BasicNotification(this.id);
     44      this.notifyObj.options.learnMoreURL = "https://mozilla.org";
     45      showNotification(this.notifyObj);
     46    },
     47    onShown(popup) {
     48      checkPopup(popup, this.notifyObj);
     49      let notification = popup.children[0];
     50      let link = notification.querySelector(
     51        ".popup-notification-learnmore-link"
     52      );
     53      is(link.textContent, "Learn more", "correct label");
     54      is(link.href, "https://mozilla.org", "correct href");
     55      isnot(
     56        window.getComputedStyle(link).getPropertyValue("display"),
     57        "none",
     58        "link not hidden"
     59      );
     60      dismissNotification(popup);
     61    },
     62    onHidden() {},
     63  },
     64 ];