react-openfin-mat-impl
Version:
Materialize UI implementation of react-openfin
109 lines • 4.5 kB
JavaScript
"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 Business_1 = require("@material-ui/icons/Business");
const react_router_1 = require("react-router");
const ChildWindow_1 = require("./ChildWindow");
const components_1 = require("../../components");
const Snackbar_1 = require("@material-ui/core/Snackbar");
const muiTheme = styles_1.createMuiTheme({});
const ViewOne = ({}) => {
return (React.createElement(React.Fragment, null, "dummy view one"));
};
const childRoutes = [
{
path: '/childWindow/view-one',
sidebarName: "viewOne.sidebar",
navbarName: "viewOne.navbar",
icon: Business_1.default,
component: ViewOne,
},
];
describe('ChildWindow layout', () => {
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 in normal state correctly by default', () => {
const wrapper = mount(React.createElement(react_openfin_1.ReactOpenfin, null,
React.createElement(styles_2.ThemeProvider, { theme: muiTheme },
React.createElement(react_router_1.MemoryRouter, { initialEntries: ['/childWindow/view-one'] },
React.createElement(ChildWindow_1.default, { appLogo: '', routes: childRoutes, location: { pathname: '/childWindow/view-one' } })))));
expect(wrapper.find(ViewOne)).toHaveLength(1);
expect(wrapper.find(ChildWindow_1.default)).toHaveLength(1);
wrapper.find(components_1.Header).props().onMinimize();
wrapper.find(components_1.Header).props().onMaximize();
wrapper.find(components_1.Header).props().onClose();
expect(wrapper.find(Snackbar_1.default)).toHaveLength(1);
// wrapper.find(Snackbar).props().onClose();
// wrapper.find(Snackbar).props().onExited();
});
// it('render SnackbarContent and could be closed correctly',()=>{
// const initState = {
// application:{
// username:'',
// computerName:'',
// machineId:null,
// deviceUserId:null,
// loading:true,
// drawerOpen:true,
// launchBarCollapse:false,
// snackBarOpen:true,
// snackBarMsgInfo:{
// variant:'primary',
// message:'message',
// },
// snackBarMsgQueue:[],
// openfinVersion:'n/a',
// openfinHostSpec:{},
// windowsState:'normal',
// },
// client:{
// count:0,
// },
// config:rootDefaultState.config,
// }
// const store = mockStore(initState);
// const wrapper = mount(
// <ThemeProvider theme={muiTheme}>
// <Provider store={store}>
// <MemoryRouter initialEntries={['/childWindow/view-one']}>
// <GlobalContext config={rootDefaultState.config}>
// <ChildWindow location={{pathname:'/childWindow/view-one'}}/>
// </GlobalContext>
// </MemoryRouter>
// </Provider>
// </ThemeProvider>
// );
// expect(wrapper.find(ViewOne)).toHaveLength(1);
// expect(wrapper.find(ChildWindow)).toHaveLength(1);
// wrapper.find(Header).props().onMinimize();
// wrapper.find(Header).props().onMaximize();
// wrapper.find(Header).props().onClose();
// // SnackbarContent events
// expect(wrapper.find(SnackbarContent)).toHaveLength(1);
// wrapper.find(SnackbarContent).props().onClose();
//
// expect(store.getActions()).toMatchSnapshot();
// })
});
//# sourceMappingURL=ChildWindow.spec.js.map