UNPKG

react-openfin-mat-impl

Version:
81 lines 3.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const react_openfin_1 = require("react-openfin"); const styles_1 = require("@material-ui/core/styles"); const styles_2 = require("@material-ui/styles"); const test_utils_1 = require("@material-ui/core/test-utils"); const Button_1 = require("@material-ui/core/Button"); const IconButton_1 = require("@material-ui/core/IconButton"); const Accessibility_1 = require("@material-ui/icons/Accessibility"); const LaunchBar_1 = require("./LaunchBar"); const muiTheme = styles_1.createMuiTheme({}); exports.sampleItems = [ { icon: Accessibility_1.default, disabled: false, svg: null, appJson: { name: `REACT_APP_FIN_UUID-child-accessibility`, url: '/childWindow/accessibility', frame: false, resizable: true, state: 'normal', autoShow: true, minWidth: 520, minHeight: 170, }, }, ]; describe('LaunchBar Layout', () => { let shallow; let mount; beforeAll(() => { react_openfin_1.InitializeReactOpenfin({ finUuid: process.env.REACT_APP_FIN_UUID, finMockupForceSilentMode: true, i18n: {}, hist: {}, configTabs: [], launchBarItems: [], }); mount = test_utils_1.createMount(); }); afterAll(() => { mount.cleanUp(); }); beforeEach(() => { shallow = test_utils_1.createShallow(); }); it('render correctly and launch all non-disabled windows', () => { const wrapper = mount(React.createElement(react_openfin_1.ReactOpenfin, null, React.createElement(styles_2.ThemeProvider, { theme: muiTheme }, React.createElement(LaunchBar_1.default, { appLogo: '', items: exports.sampleItems })))); wrapper.find(IconButton_1.default).forEach((iconBtn) => { const props = iconBtn.props(); if (props.disabled === false && typeof props.onClick === 'function') { props.onClick(); } }); }); it('trigger all control panel btns', () => { const wrapper = mount(React.createElement(react_openfin_1.ReactOpenfin, null, React.createElement(styles_2.ThemeProvider, { theme: muiTheme }, React.createElement(LaunchBar_1.default, { appLogo: '', items: exports.sampleItems })))); wrapper.find(Button_1.default).forEach((btn) => { const props = btn.props(); if (typeof props.onClick === 'function') { props.onClick(); } }); }); // it('render collapsed button container',()=>{ // const wrapper = mount( // <ThemeProvider theme={muiTheme}> // <LaunchBar/> // </ThemeProvider> // ); // expect(wrapper).toBeTruthy(); // }); }); //# sourceMappingURL=LaunchBar.spec.js.map