tor-browser

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

test_add_device.js (862B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test adding a new device.
      7 
      8 const {
      9  addDevice,
     10  addDeviceType,
     11 } = require("resource://devtools/client/responsive/actions/devices.js");
     12 
     13 add_task(async function () {
     14  const store = Store();
     15  const { getState, dispatch } = store;
     16 
     17  const device = {
     18    name: "Firefox OS Flame",
     19    width: 320,
     20    height: 570,
     21    pixelRatio: 1.5,
     22    userAgent: "Mozilla/5.0 (Mobile; rv:39.0) Gecko/39.0 Firefox/39.0",
     23    touch: true,
     24    firefoxOS: true,
     25    os: "fxos",
     26  };
     27 
     28  dispatch(addDeviceType("phones"));
     29  dispatch(addDevice(device, "phones"));
     30 
     31  equal(getState().devices.phones.length, 1, "Correct number of phones");
     32  ok(
     33    getState().devices.phones.includes(device),
     34    "Device phone list contains Firefox OS Flame"
     35  );
     36 });