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