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