test_change_pixel_ratio.js (656B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test changing the viewport pixel ratio. 7 8 const { 9 addViewport, 10 changePixelRatio, 11 } = require("resource://devtools/client/responsive/actions/viewports.js"); 12 const NEW_PIXEL_RATIO = 5.5; 13 14 add_task(async function () { 15 const store = Store(); 16 const { getState, dispatch } = store; 17 18 dispatch(addViewport()); 19 dispatch(changePixelRatio(0, NEW_PIXEL_RATIO)); 20 21 const viewport = getState().viewports[0]; 22 equal( 23 viewport.pixelRatio, 24 NEW_PIXEL_RATIO, 25 `Viewport's pixel ratio changed to ${NEW_PIXEL_RATIO}` 26 ); 27 });