diff --git a/src/frontend/apps/desk/.env.development b/src/frontend/apps/desk/.env.development index 45ee232..4cb4d49 100644 --- a/src/frontend/apps/desk/.env.development +++ b/src/frontend/apps/desk/.env.development @@ -1 +1,2 @@ NEXT_PUBLIC_API_ORIGIN=http://localhost:8071 +NEXT_PUBLIC_FEATURE_TEAM=true diff --git a/src/frontend/apps/desk/.env.test b/src/frontend/apps/desk/.env.test index 9a4d514..026733c 100644 --- a/src/frontend/apps/desk/.env.test +++ b/src/frontend/apps/desk/.env.test @@ -1 +1,2 @@ NEXT_PUBLIC_API_ORIGIN=http://test.jest +NEXT_PUBLIC_FEATURE_TEAM=true diff --git a/src/frontend/apps/desk/src/core/MainLayout.tsx b/src/frontend/apps/desk/src/core/MainLayout.tsx index 617e004..88b6ccf 100644 --- a/src/frontend/apps/desk/src/core/MainLayout.tsx +++ b/src/frontend/apps/desk/src/core/MainLayout.tsx @@ -11,7 +11,7 @@ export function MainLayout({ children }: PropsWithChildren) {
- + {process.env.NEXT_PUBLIC_FEATURE_TEAM === 'true' && } ({ + ...jest.requireActual('next/navigation'), + usePathname: () => '/', +})); + +describe('MainLayout', () => { + it('checks menu rendering', () => { + render(, { wrapper: AppWrapper }); + + expect( + screen.getByRole('button', { + name: /Teams button/i, + }), + ).toBeInTheDocument(); + + expect( + screen.getByRole('button', { + name: /Mail Domains button/i, + }), + ).toBeInTheDocument(); + }); + + it('checks menu rendering without team feature', () => { + process.env.NEXT_PUBLIC_FEATURE_TEAM = 'false'; + + render(, { wrapper: AppWrapper }); + + expect( + screen.queryByRole('button', { + name: /Teams button/i, + }), + ).not.toBeInTheDocument(); + + expect( + screen.queryByRole('button', { + name: /Mail Domains button/i, + }), + ).not.toBeInTheDocument(); + }); +}); diff --git a/src/frontend/apps/desk/src/features/mail-domains/components/panel/Panel.tsx b/src/frontend/apps/desk/src/features/mail-domains/components/panel/Panel.tsx index 7f1c13b..8c009f3 100644 --- a/src/frontend/apps/desk/src/features/mail-domains/components/panel/Panel.tsx +++ b/src/frontend/apps/desk/src/features/mail-domains/components/panel/Panel.tsx @@ -21,6 +21,11 @@ export const Panel = () => { $minWidth: '0', }; + const styleNoTeam = process.env.NEXT_PUBLIC_FEATURE_TEAM !== 'true' && { + $display: 'none', + tabIndex: -1, + }; + const transition = 'all 0.5s ease-in-out'; return ( @@ -52,6 +57,7 @@ export const Panel = () => { transition: ${transition}; `} onClick={() => setIsOpen(!isOpen)} + {...styleNoTeam} >