tor-browser

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

browser_viewport_basics.js (860B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test viewports basics after opening, like size and location
      7 
      8 const TEST_URL = "https://example.org/";
      9 addRDMTask(TEST_URL, async function ({ ui }) {
     10  const browser = ui.getViewportBrowser();
     11 
     12  is(
     13    ui.toolWindow.getComputedStyle(browser).getPropertyValue("width"),
     14    "320px",
     15    "Viewport has default width"
     16  );
     17  is(
     18    ui.toolWindow.getComputedStyle(browser).getPropertyValue("height"),
     19    "480px",
     20    "Viewport has default height"
     21  );
     22 
     23  // Browser's location should match original tab
     24  await navigateTo(TEST_URL, { browser });
     25 
     26  const location = await spawnViewportTask(ui, {}, function () {
     27    return content.location.href; // eslint-disable-line
     28  });
     29  is(location, TEST_URL, "Viewport location matches");
     30 });