diff --git a/src/shell/shell-secondary-bar.tsx b/src/shell/shell-secondary-bar.tsx index 99875763..091e14a4 100644 --- a/src/shell/shell-secondary-bar.tsx +++ b/src/shell/shell-secondary-bar.tsx @@ -13,7 +13,7 @@ import { AppRoute } from '../../types'; import AppContextProvider from '../boot/app/app-context-provider'; import { useCurrentRoute } from '../history/hooks'; import { useAppStore } from '../store/app'; -import { useUtilityBarStore } from '../utility-bar'; +import { useUtilityBarStore } from '../utility-bar/store'; import { checkRoute } from '../utility-bar/utils'; import { Collapser } from './collapser'; diff --git a/src/shell/shell-view.test.tsx b/src/shell/shell-view.test.tsx new file mode 100644 index 00000000..27820e09 --- /dev/null +++ b/src/shell/shell-view.test.tsx @@ -0,0 +1,81 @@ +/* + * SPDX-FileCopyrightText: 2023 Zextras + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +import React, { FC } from 'react'; +import { act, screen } from '@testing-library/react'; +import { useHistory } from 'react-router-dom'; +import { setup } from '../test/utils'; +import ShellView from './shell-view'; +import { useBoardStore } from '../store/boards'; +import { Board } from '../../types'; +import { useAppStore } from '../store/app'; +import { useBridge } from '../store/context-bridge'; + +const ContextBridge: FC = () => { + const history = useHistory(); + useBridge({ + functions: { + getHistory: () => history + } + }); + return null; +}; + +const Dummy: FC = () => null; + +jest.mock('../utility-bar/bar', () => ({ + ShellUtilityBar: Dummy +})); + +jest.mock('./shell-header', () => Dummy); + +test('When resizing under mobile breakpoint, board does not disappear', () => { + const boards: Record = { + 'board-1': { id: 'board-1', url: '/url', app: 'app', title: 'title1', icon: 'CubeOutline' } + }; + + useBoardStore.setState(() => ({ + boards, + orderedBoards: ['board-1'], + current: 'board-1' + })); + + useAppStore.getState().setters.addApps([ + { + commit: '', + description: 'Mails module', + display: 'Mails', + icon: 'MailModOutline', + js_entrypoint: '', + name: 'carbonio-mails-ui', + priority: 1, + type: 'carbonio', + version: '0.0.1' + } + ]); + useAppStore.getState().setters.addRoute({ + id: 'mails', + route: 'mails', + position: 1, + visible: true, + label: 'Mails', + primaryBar: 'MailModOutline', + appView: () =>
, + badge: { show: false }, + app: 'carbonio-mails-ui' + }); + + setup( + <> + + + ); + + expect(screen.getByText('title1')).toBeVisible(); + act(() => { + window.resizeTo(500, 300); + }); + expect(screen.getByText('title1')).toBeVisible(); +}); diff --git a/src/shell/shell-view.tsx b/src/shell/shell-view.tsx index 59bae9b7..7a3e1e42 100644 --- a/src/shell/shell-view.tsx +++ b/src/shell/shell-view.tsx @@ -14,13 +14,14 @@ import { IS_STANDALONE } from '../constants'; import { useCurrentRoute } from '../history/hooks'; import { goToLogin } from '../network/go-to-login'; import { useAccountStore } from '../store/account'; -import { ShellUtilityBar, ShellUtilityPanel } from '../utility-bar'; +import { ShellUtilityBar } from '../utility-bar/bar'; import AppViewContainer from './app-view-container'; import { BoardContainer } from './boards/board-container'; import ShellContextProvider from './shell-context-provider'; import ShellHeader from './shell-header'; import ShellNavigationBar from './shell-navigation-bar'; import { useDarkReaderResultValue } from '../dark-mode/use-dark-reader-result-value'; +import { ShellUtilityPanel } from '../utility-bar/panel'; const Background = styled.div` background: ${({ theme }): string => theme.palette.gray6.regular}; @@ -82,9 +83,7 @@ const ShellComponent = ({ - - - + ); }; diff --git a/src/utility-bar/index.ts b/src/utility-bar/index.ts deleted file mode 100644 index a33fa520..00000000 --- a/src/utility-bar/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 Zextras - * - * SPDX-License-Identifier: AGPL-3.0-only - */ -export * from './bar'; -export * from './panel'; -export * from './store';