Skip to content

Commit 68a3733

Browse files
committed
feat: remove ENABLE_UNIT_PAGE_NEW_DESIGN
1 parent 29987b6 commit 68a3733

16 files changed

Lines changed: 38 additions & 524 deletions

File tree

src/course-unit/CourseUnit.test.tsx

Lines changed: 8 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ describe('<CourseUnit />', () => {
281281
},
282282
});
283283

284-
const courseUnitSidebar = await screen.findByTestId('course-unit-sidebar');
284+
const courseUnitSidebar = screen.getByTestId('sidebar');
285285
expect(
286286
within(courseUnitSidebar).getByText(legacySidebarMessages.sidebarTitleDraftUnpublishedChanges.defaultMessage),
287287
).toBeInTheDocument();
@@ -313,7 +313,7 @@ describe('<CourseUnit />', () => {
313313
},
314314
});
315315

316-
const courseUnitSidebar = await screen.findByTestId('course-unit-sidebar');
316+
const courseUnitSidebar = screen.getByTestId('sidebar');
317317
expect(
318318
within(courseUnitSidebar).getByText(legacySidebarMessages.sidebarTitleDraftUnpublishedChanges.defaultMessage),
319319
).toBeInTheDocument();
@@ -1112,7 +1112,7 @@ describe('<CourseUnit />', () => {
11121112
let visibilityCheckbox;
11131113

11141114
await waitFor(async () => {
1115-
courseUnitSidebar = screen.getByTestId('course-unit-sidebar');
1115+
courseUnitSidebar = screen.getByTestId('sidebar');
11161116

11171117
draftUnpublishedChangesHeading = within(courseUnitSidebar)
11181118
.getByText(legacySidebarMessages.sidebarTitleDraftUnpublishedChanges.defaultMessage);
@@ -1189,7 +1189,7 @@ describe('<CourseUnit />', () => {
11891189
let publishBtn;
11901190

11911191
await waitFor(async () => {
1192-
courseUnitSidebar = screen.getByTestId('course-unit-sidebar');
1192+
courseUnitSidebar = screen.getByTestId('sidebar');
11931193
publishBtn = within(courseUnitSidebar).queryByRole('button', { name: legacySidebarMessages.actionButtonPublishTitle.defaultMessage });
11941194
expect(publishBtn).toBeInTheDocument();
11951195

@@ -1232,7 +1232,7 @@ describe('<CourseUnit />', () => {
12321232
let discardChangesBtn;
12331233

12341234
await waitFor(async () => {
1235-
courseUnitSidebar = screen.getByTestId('course-unit-sidebar');
1235+
courseUnitSidebar = screen.getByTestId('sidebar');
12361236

12371237
const draftUnpublishedChangesHeading = within(courseUnitSidebar)
12381238
.getByText(legacySidebarMessages.sidebarTitleDraftUnpublishedChanges.defaultMessage);
@@ -1294,7 +1294,7 @@ describe('<CourseUnit />', () => {
12941294
let restrictAccessSelect;
12951295

12961296
await waitFor(async () => {
1297-
courseUnitSidebar = screen.getByTestId('course-unit-sidebar');
1297+
courseUnitSidebar = screen.getByTestId('sidebar');
12981298
sidebarVisibilityCheckbox = within(courseUnitSidebar)
12991299
.getByLabelText(unitInfoMessages.visibilityCheckboxTitle.defaultMessage);
13001300
expect(sidebarVisibilityCheckbox).not.toBeChecked();
@@ -2031,34 +2031,6 @@ describe('<CourseUnit />', () => {
20312031
});
20322032
};
20332033

2034-
const checkRenderVisibilityModal = async (headingMessageId) => {
2035-
const user = userEvent.setup();
2036-
const { findByRole, getByTestId } = render(<RootWrapper />);
2037-
let configureModal;
2038-
let restrictAccessSelect;
2039-
2040-
const headerConfigureBtn = await findByRole('button', { name: /settings/i });
2041-
await user.click(headerConfigureBtn);
2042-
2043-
await waitFor(() => {
2044-
configureModal = getByTestId('configure-modal');
2045-
restrictAccessSelect = within(configureModal)
2046-
.getByRole('combobox', { name: configureModalMessages.restrictAccessTo.defaultMessage });
2047-
expect(within(configureModal)
2048-
.getByRole('heading', { name: configureModalMessages[headingMessageId].defaultMessage })).toBeInTheDocument();
2049-
expect(within(configureModal)
2050-
.queryByText(configureModalMessages.unitVisibility.defaultMessage)).not.toBeInTheDocument();
2051-
expect(within(configureModal)
2052-
.getByText(configureModalMessages.restrictAccessTo.defaultMessage)).toBeInTheDocument();
2053-
expect(restrictAccessSelect).toBeInTheDocument();
2054-
expect(restrictAccessSelect).toHaveValue('-1');
2055-
});
2056-
2057-
const modalSaveBtn = within(configureModal)
2058-
.getByRole('button', { name: configureModalMessages.saveButton.defaultMessage });
2059-
await user.click(modalSaveBtn);
2060-
};
2061-
20622034
describe('Library Content page', () => {
20632035
const newUnitId = '12345';
20642036

@@ -2116,10 +2088,6 @@ describe('<CourseUnit />', () => {
21162088
});
21172089
});
21182090

2119-
it('should display visibility modal correctly', async () => (
2120-
checkRenderVisibilityModal('libraryContentAccess')
2121-
));
2122-
21232091
it('opens legacy edit modal on edit button click', checkLegacyEditModalOnEditMessage);
21242092
});
21252093

@@ -2255,10 +2223,6 @@ describe('<CourseUnit />', () => {
22552223
});
22562224
});
22572225

2258-
it('should display visibility modal correctly', async () => (
2259-
checkRenderVisibilityModal('splitTestAccess')
2260-
));
2261-
22622226
it('opens legacy edit modal on edit button click', checkLegacyEditModalOnEditMessage);
22632227
});
22642228

@@ -2332,7 +2296,7 @@ describe('<CourseUnit />', () => {
23322296
expect(editButton).toBeEnabled();
23332297

23342298
// The "Publish" button should still be enabled
2335-
const courseUnitSidebar = screen.getByTestId('course-unit-sidebar');
2299+
const courseUnitSidebar = screen.getByTestId('sidebar');
23362300
const publishButton = within(courseUnitSidebar).getByRole(
23372301
'button',
23382302
{ name: legacySidebarMessages.actionButtonPublishTitle.defaultMessage },
@@ -2344,11 +2308,7 @@ describe('<CourseUnit />', () => {
23442308
expect(screen.queryByText(addComponentMessages.title.defaultMessage)).not.toBeInTheDocument();
23452309
});
23462310

2347-
it('renders new unit info/settings sidebar', async () => {
2348-
setConfig({
2349-
...getConfig(),
2350-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2351-
});
2311+
it('renders unit info/settings sidebar', async () => {
23522312
const user = userEvent.setup();
23532313
render(<RootWrapper />);
23542314

@@ -2373,10 +2333,6 @@ describe('<CourseUnit />', () => {
23732333
});
23742334

23752335
it('displays the live state in the status bar', async () => {
2376-
setConfig({
2377-
...getConfig(),
2378-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2379-
});
23802336
axiosMock
23812337
.onGet(getCourseSectionVerticalApiUrl(blockId))
23822338
.reply(200, {
@@ -2473,11 +2429,6 @@ describe('<CourseUnit />', () => {
24732429
});
24742430

24752431
it('displays the staff only state in the status bar', async () => {
2476-
setConfig({
2477-
...getConfig(),
2478-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2479-
});
2480-
24812432
axiosMock
24822433
.onGet(getCourseSectionVerticalApiUrl(blockId))
24832434
.reply(200, {
@@ -2497,10 +2448,6 @@ describe('<CourseUnit />', () => {
24972448

24982449
it('should disable discussions in the settings sidebar', async () => {
24992450
const user = userEvent.setup();
2500-
setConfig({
2501-
...getConfig(),
2502-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2503-
});
25042451
render(<RootWrapper />);
25052452

25062453
axiosMock
@@ -2553,11 +2500,6 @@ describe('<CourseUnit />', () => {
25532500

25542501
it('should update the group access in the unit sidebar', async () => {
25552502
const user = userEvent.setup();
2556-
2557-
setConfig({
2558-
...getConfig(),
2559-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2560-
});
25612503
render(<RootWrapper />);
25622504

25632505
axiosMock
@@ -2633,10 +2575,6 @@ describe('<CourseUnit />', () => {
26332575
});
26342576

26352577
it('should one group in the visibility field in the unit sidebar', async () => {
2636-
setConfig({
2637-
...getConfig(),
2638-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2639-
});
26402578
render(<RootWrapper />);
26412579

26422580
axiosMock
@@ -2688,10 +2626,6 @@ describe('<CourseUnit />', () => {
26882626
});
26892627

26902628
it('should multiple groups in the visibility field in the unit sidebar', async () => {
2691-
setConfig({
2692-
...getConfig(),
2693-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2694-
});
26952629
render(<RootWrapper />);
26962630

26972631
axiosMock
@@ -2746,10 +2680,6 @@ describe('<CourseUnit />', () => {
27462680
});
27472681

27482682
it('should render never published state in the unit sidebar', async () => {
2749-
setConfig({
2750-
...getConfig(),
2751-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2752-
});
27532683
render(<RootWrapper />);
27542684

27552685
axiosMock
@@ -2776,10 +2706,6 @@ describe('<CourseUnit />', () => {
27762706
});
27772707

27782708
it('displays the scheduled state in the status bar', async () => {
2779-
setConfig({
2780-
...getConfig(),
2781-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2782-
});
27832709
axiosMock
27842710
.onGet(getCourseSectionVerticalApiUrl(blockId))
27852711
.reply(200, {
@@ -2796,10 +2722,6 @@ describe('<CourseUnit />', () => {
27962722
});
27972723

27982724
it('displays the draft changes state in the status bar', async () => {
2799-
setConfig({
2800-
...getConfig(),
2801-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2802-
});
28032725
axiosMock
28042726
.onGet(getCourseSectionVerticalApiUrl(blockId))
28052727
.reply(200, {
@@ -2816,10 +2738,6 @@ describe('<CourseUnit />', () => {
28162738
});
28172739

28182740
it('displays discussions enabled label in the status bar', async () => {
2819-
setConfig({
2820-
...getConfig(),
2821-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2822-
});
28232741
axiosMock
28242742
.onGet(getCourseSectionVerticalApiUrl(blockId))
28252743
.reply(200, {
@@ -2835,10 +2753,6 @@ describe('<CourseUnit />', () => {
28352753
});
28362754

28372755
it('displays group access with one group in the status bar', async () => {
2838-
setConfig({
2839-
...getConfig(),
2840-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2841-
});
28422756
axiosMock
28432757
.onGet(getCourseSectionVerticalApiUrl(blockId))
28442758
.reply(200, {
@@ -2882,10 +2796,6 @@ describe('<CourseUnit />', () => {
28822796
});
28832797

28842798
it('displays group access with multiple groups in the status bar', async () => {
2885-
setConfig({
2886-
...getConfig(),
2887-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2888-
});
28892799
axiosMock
28902800
.onGet(getCourseSectionVerticalApiUrl(blockId))
28912801
.reply(200, {
@@ -2932,7 +2842,6 @@ describe('<CourseUnit />', () => {
29322842
setConfig({
29332843
...getConfig(),
29342844
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
2935-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
29362845
});
29372846

29382847
render(<RootWrapper />);
@@ -2963,11 +2872,6 @@ describe('<CourseUnit />', () => {
29632872
};
29642873

29652874
beforeEach(async () => {
2966-
setConfig({
2967-
...getConfig(),
2968-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2969-
});
2970-
29712875
// The Meilisearch client-side API uses fetch, not Axios.
29722876
fetchMock.mockReset();
29732877
fetchMock.post(searchEndpoint, (_url, req) => {
@@ -3211,10 +3115,6 @@ describe('<CourseUnit />', () => {
32113115
});
32123116

32133117
it('not render add sidebar in units from libraries (read-only)', async () => {
3214-
setConfig({
3215-
...getConfig(),
3216-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
3217-
});
32183118
render(<RootWrapper />);
32193119

32203120
axiosMock
@@ -3247,11 +3147,6 @@ describe('<CourseUnit />', () => {
32473147
});
32483148

32493149
it('opens the component info sidebar on postMessage event', async () => {
3250-
setConfig({
3251-
...getConfig(),
3252-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
3253-
});
3254-
32553150
render(<RootWrapper />);
32563151

32573152
await screen.findByTitle(xblockContainerIframeMessages.xblockIframeTitle.defaultMessage);

src/course-unit/CourseUnit.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import CourseUnitHeaderActionsSlot from '../plugin-slots/CourseUnitHeaderActions
4747
import { UnitSidebarProvider } from './unit-sidebar/UnitSidebarContext';
4848
import { UnitSidebarPagesProvider } from './unit-sidebar/UnitSidebarPagesContext';
4949
import { UNIT_VISIBILITY_STATES } from './constants';
50-
import { isUnitPageNewDesignEnabled } from './utils';
5150

5251
const StatusBar = ({ courseUnit }: { courseUnit: any }) => {
5352
const { selectedPartitionIndex, selectedGroupsLabel } = courseUnit.userPartitionInfo ?? {};
@@ -297,7 +296,6 @@ const CourseUnit = () => {
297296
isTitleEditFormOpen={isTitleEditFormOpen}
298297
handleTitleEdit={handleTitleEdit}
299298
handleTitleEditSubmit={handleTitleEditSubmit}
300-
handleConfigureSubmit={handleConfigureSubmit}
301299
/>
302300
)}
303301
breadcrumbs={(
@@ -316,7 +314,7 @@ const CourseUnit = () => {
316314
)}
317315
/>
318316
<div className="unit-header-status-bar h5 mt-2 mb-4 font-weight-normal">
319-
{isUnitPageNewDesignEnabled() && isUnitVerticalType && (
317+
{isUnitVerticalType && (
320318
<StatusBar courseUnit={courseUnit} />
321319
)}
322320
</div>

src/course-unit/header-navigations/HeaderNavigations.test.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ describe('<HeaderNavigations />', () => {
7979
});
8080

8181
it('click Info button should open info sidebar', async () => {
82-
setConfig({
83-
...getConfig(),
84-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
85-
});
86-
8782
const user = userEvent.setup();
8883
renderComponent({ unitCategory: COURSE_BLOCK_NAMES.vertical.id });
8984

@@ -95,11 +90,6 @@ describe('<HeaderNavigations />', () => {
9590
});
9691

9792
it('click Add button should open add sidebar', async () => {
98-
setConfig({
99-
...getConfig(),
100-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
101-
});
102-
10393
const user = userEvent.setup();
10494
renderComponent({ unitCategory: COURSE_BLOCK_NAMES.vertical.id });
10595

0 commit comments

Comments
 (0)