tor-browser

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

test_rotate_viewport.js (732B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test rotating the viewport.
      7 
      8 const {
      9  addViewport,
     10  rotateViewport,
     11 } = require("resource://devtools/client/responsive/actions/viewports.js");
     12 
     13 add_task(async function () {
     14  const store = Store();
     15  const { getState, dispatch } = store;
     16 
     17  dispatch(addViewport());
     18 
     19  let viewport = getState().viewports[0];
     20  equal(viewport.width, 320, "Default width of 320");
     21  equal(viewport.height, 480, "Default height of 480");
     22 
     23  dispatch(rotateViewport(0));
     24  viewport = getState().viewports[0];
     25  equal(viewport.width, 480, "Rotated width of 480");
     26  equal(viewport.height, 320, "Rotated height of 320");
     27 });