test_add_viewport.js (685B)
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 viewports to the page. 7 8 const { 9 addViewport, 10 } = require("resource://devtools/client/responsive/actions/viewports.js"); 11 12 add_task(async function () { 13 const store = Store(); 14 const { getState, dispatch } = store; 15 16 equal(getState().viewports.length, 0, "Defaults to no viewpots at startup"); 17 18 dispatch(addViewport()); 19 equal(getState().viewports.length, 1, "One viewport total"); 20 21 // For the moment, there can be at most one viewport. 22 dispatch(addViewport()); 23 equal(getState().viewports.length, 1, "One viewport total, again"); 24 });