UNPKG

react-openfin-mat-impl

Version:
39 lines 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const react_openfin_1 = require("react-openfin"); const Switch_1 = require("@material-ui/core/Switch"); const test_utils_1 = require("@material-ui/core/test-utils"); const ConfigThemeField_1 = require("./ConfigThemeField"); describe('Config Theme', () => { let shallow; let mount; beforeAll(() => { react_openfin_1.InitializeReactOpenfin({ finUuid: process.env.REACT_APP_FIN_UUID, finMockupForceSilentMode: true, i18n: {}, hist: {}, configTabs: [], launchBarItems: [], }); }); beforeEach(() => { mount = test_utils_1.createMount(); shallow = test_utils_1.createShallow(); }); afterEach(() => { mount.cleanUp(); }); it('render dark correctly and switch theme twice', () => { const wrapper = mount(React.createElement(react_openfin_1.ReactOpenfin, null, React.createElement(ConfigThemeField_1.default, null))); const switches = wrapper.find(Switch_1.default); expect(switches).toHaveLength(1); const theme1 = window[react_openfin_1.REACT_OPENFIN_STORE].getState().config.application.theme; switches.at(0).props().onChange(); const theme2 = window[react_openfin_1.REACT_OPENFIN_STORE].getState().config.application.theme; expect(theme1).not.toEqual(theme2); }); }); //# sourceMappingURL=ConfigThemeField.spec.js.map