diff --git a/src/components/ToggleXpertButton/index.jsx b/src/components/ToggleXpertButton/index.jsx index 2b9bb7a0..0321c34e 100644 --- a/src/components/ToggleXpertButton/index.jsx +++ b/src/components/ToggleXpertButton/index.jsx @@ -28,6 +28,7 @@ const ToggleXpert = ({ isOpen, setIsOpen, courseId }) => { }; return ( + (!isOpen && (
{!hasDismissed && (
@@ -57,6 +58,7 @@ const ToggleXpert = ({ isOpen, setIsOpen, courseId }) => {
+ )) ); }; diff --git a/src/widgets/Xpert.test.jsx b/src/widgets/Xpert.test.jsx index 83f9449b..924fe4a5 100644 --- a/src/widgets/Xpert.test.jsx +++ b/src/widgets/Xpert.test.jsx @@ -182,15 +182,14 @@ test('clicking the close button closes the sidebar', async () => { // assert that UI elements in the sidebar are not in the DOM assertSidebarElementsNotInDOM(); }); -test('clicking the toggle button closes the sidebar', async () => { +test('toggle elements do not appear when sidebar is open', async () => { const user = userEvent.setup(); render(, { preloadedState: initialState }); await user.click(screen.queryByTestId('toggle-button')); - await user.click(screen.getByTestId('toggle-button')); - // assert that UI elements in the sidebar are not in the DOM - assertSidebarElementsNotInDOM(); + expect(screen.queryByTestId('toggle-button')).not.toBeInTheDocument(); + expect(screen.queryByTestId('action-message')).not.toBeInTheDocument(); }); test('error message should disappear upon succesful api call', async () => { const user = userEvent.setup();