tor-browser

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

test_resize_viewport.js (996B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test resizing the viewport.
      7 
      8 const {
      9  addViewport,
     10  resizeViewport,
     11 } = require("resource://devtools/client/responsive/actions/viewports.js");
     12 const {
     13  toggleTouchSimulation,
     14 } = require("resource://devtools/client/responsive/actions/ui.js");
     15 
     16 add_task(async function () {
     17  const store = Store();
     18  const { getState, dispatch } = store;
     19 
     20  dispatch(addViewport());
     21  dispatch(resizeViewport(0, 500, 500));
     22 
     23  let viewport = getState().viewports[0];
     24  equal(viewport.width, 500, "Resized width of 500");
     25  equal(viewport.height, 500, "Resized height of 500");
     26 
     27  dispatch(toggleTouchSimulation(true));
     28  dispatch(resizeViewport(0, 400, 400));
     29 
     30  viewport = getState().viewports[0];
     31  equal(viewport.width, 400, "Resized width of 400 (with touch simulation on)");
     32  equal(
     33    viewport.height,
     34    400,
     35    "Resized height of 400 (with touch simulation on)"
     36  );
     37 });