diff --git a/.env b/.env index cae1caf83b..684025852e 100644 --- a/.env +++ b/.env @@ -47,4 +47,4 @@ TWITTER_HASHTAG='' TWITTER_URL='' USER_INFO_COOKIE_NAME='' OPTIMIZELY_FULL_STACK_SDK_KEY='' -ENABLE_SIDEBAR_NEW_VIEW='false' \ No newline at end of file +ENABLE_SIDEBAR_NEW_VIEW='false' diff --git a/src/courseware/course/new-sidebar/sidebars/discussions/DiscussionsSidebar.test.jsx b/src/courseware/course/new-sidebar/sidebars/discussions/DiscussionsSidebar.test.jsx index 59c31b1cf7..7443d6373f 100644 --- a/src/courseware/course/new-sidebar/sidebars/discussions/DiscussionsSidebar.test.jsx +++ b/src/courseware/course/new-sidebar/sidebars/discussions/DiscussionsSidebar.test.jsx @@ -33,7 +33,9 @@ describe('Discussions Trigger', () => { mockData = { courseId, unitId, - currentSidebar: 'DISCUSSIONS', + currentSidebar: 'NEWSIDEBAR', + hideDiscussionbar: false, + isDiscussionbarAvailable: true, }; axiosMock.onGet(`${getConfig().LMS_BASE_URL}/api/discussion/v1/courses/${courseId}`).reply( @@ -64,7 +66,7 @@ describe('Discussions Trigger', () => { }); it('should show nothing if unit has no discussions associated with it', async () => { - renderWithProvider({ unitId: 'no-discussion' }); + renderWithProvider({ isDiscussionbarAvailable: false }); expect(screen.queryByTitle('Discussions')).not.toBeInTheDocument(); }); }); diff --git a/src/courseware/course/new-sidebar/sidebars/notifications/NotificationTray.test.jsx b/src/courseware/course/new-sidebar/sidebars/notifications/NotificationTray.test.jsx index 383d587d35..46e3b4f8df 100644 --- a/src/courseware/course/new-sidebar/sidebars/notifications/NotificationTray.test.jsx +++ b/src/courseware/course/new-sidebar/sidebars/notifications/NotificationTray.test.jsx @@ -6,9 +6,7 @@ import { breakpoints } from '@edx/paragon'; import MockAdapter from 'axios-mock-adapter'; import React from 'react'; import { Factory } from 'rosie'; -import { - fireEvent, initializeMockApp, render, screen, waitFor, -} from '../../../../../setupTest'; +import { initializeMockApp, render, screen } from '../../../../../setupTest'; import initializeStore from '../../../../../store'; import { appendBrowserTimezoneToUrl, executeThunk } from '../../../../../utils'; @@ -50,42 +48,13 @@ describe('NotificationTray', () => { axiosMock.onGet(courseHomeMetadataUrl).reply(200, courseHomeMetadata); }); - it('renders notification tray and close tray button', async () => { - global.innerWidth = breakpoints.extraLarge.minWidth; - const toggleNotificationTray = jest.fn(); - await fetchAndRender( - - - , - ); - expect(screen.getByText('Notifications')) - .toBeInTheDocument(); - const notificationCloseIconButton = screen.getByRole('button', { name: /Close notification tray/i }); - expect(notificationCloseIconButton) - .toBeInTheDocument(); - expect(notificationCloseIconButton) - .toHaveClass('btn-icon-primary'); - fireEvent.click(notificationCloseIconButton); - expect(toggleNotificationTray) - .toHaveBeenCalledTimes(1); - - // should not render responsive "Back to course" to close the tray - expect(screen.queryByText('Back to course')) - .not - .toBeInTheDocument(); - }); - it('renders upgrade card', async () => { await fetchAndRender( @@ -102,18 +71,21 @@ describe('NotificationTray', () => { .toBeInTheDocument(); }); - it('renders no notifications message if no verified mode', async () => { + it('renders no notifications bar if no verified mode', async () => { setMetadata({ verified_mode: null }); await fetchAndRender( , ); - expect(screen.queryByText('You have no new notifications at this time.')) + expect(screen.queryByText('Notifications')) + .not .toBeInTheDocument(); }); @@ -125,6 +97,8 @@ describe('NotificationTray', () => { currentSidebar: ID, courseId, onNotificationSeen, + hideNotificationbar: false, + isNotificationbarAvailable: true, }} > @@ -134,28 +108,4 @@ describe('NotificationTray', () => { jest.advanceTimersByTime(3000); expect(onNotificationSeen).toHaveBeenCalledTimes(1); }); - - it('renders notification tray with full screen "Back to course" at responsive view', async () => { - global.innerWidth = breakpoints.medium.maxWidth; - const toggleNotificationTray = jest.fn(); - await fetchAndRender( - - - , - ); - - const responsiveCloseButton = screen.getByRole('button', { name: 'Back to course' }); - await waitFor(() => expect(responsiveCloseButton) - .toBeInTheDocument()); - - fireEvent.click(responsiveCloseButton); - expect(toggleNotificationTray) - .toHaveBeenCalledTimes(1); - }); });