@@ -149,6 +149,7 @@ const RootWrapper = () => (
149149describe ( '<CourseUnit />' , ( ) => {
150150 beforeEach ( async ( ) => {
151151 const mocks = initializeMocks ( ) ;
152+
152153 window . scrollTo = jest . fn ( ) ;
153154 global . localStorage . clear ( ) ;
154155 store = mocks . reduxStore ;
@@ -180,6 +181,10 @@ describe('<CourseUnit />', () => {
180181 } ) ;
181182
182183 it ( 'render CourseUnit component correctly' , async ( ) => {
184+ setConfig ( {
185+ ...getConfig ( ) ,
186+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
187+ } ) ;
183188 render ( < RootWrapper /> ) ;
184189 const currentSectionName = courseSectionVerticalMock . xblock_info . ancestor_info . ancestors [ 1 ] . display_name ;
185190 const currentSubSectionName = courseSectionVerticalMock . xblock_info . ancestor_info . ancestors [ 1 ] . display_name ;
@@ -271,6 +276,10 @@ describe('<CourseUnit />', () => {
271276 } ) ;
272277
273278 it ( 'closes legacy edit modal and updates course unit sidebar after saveEditedXBlockData message' , async ( ) => {
279+ setConfig ( {
280+ ...getConfig ( ) ,
281+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
282+ } ) ;
274283 render ( < RootWrapper /> ) ;
275284
276285 const xblocksIframe = await screen . findByTitle ( xblockContainerIframeMessages . xblockIframeTitle . defaultMessage ) ;
@@ -308,6 +317,10 @@ describe('<CourseUnit />', () => {
308317 } ) ;
309318
310319 it ( 'updates course unit sidebar after receiving refreshPositions message' , async ( ) => {
320+ setConfig ( {
321+ ...getConfig ( ) ,
322+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
323+ } ) ;
311324 render ( < RootWrapper /> ) ;
312325
313326 const xblocksIframe = await screen . findByTitle ( xblockContainerIframeMessages . xblockIframeTitle . defaultMessage ) ;
@@ -341,6 +354,10 @@ describe('<CourseUnit />', () => {
341354
342355 it ( 'checks whether xblock is removed when the corresponding delete button is clicked and the sidebar is the updated' , async ( ) => {
343356 const user = userEvent . setup ( ) ;
357+ setConfig ( {
358+ ...getConfig ( ) ,
359+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
360+ } ) ;
344361 render ( < RootWrapper /> ) ;
345362
346363 const iframe = await screen . findByTitle ( xblockContainerIframeMessages . xblockIframeTitle . defaultMessage ) ;
@@ -513,6 +530,10 @@ describe('<CourseUnit />', () => {
513530 } ) ;
514531
515532 it ( 'checks if xblock is a duplicate when the corresponding duplicate button is clicked and if the sidebar status is updated' , async ( ) => {
533+ setConfig ( {
534+ ...getConfig ( ) ,
535+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
536+ } ) ;
516537 axiosMock
517538 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
518539 . reply ( 200 , {
@@ -1130,6 +1151,10 @@ describe('<CourseUnit />', () => {
11301151 } ) ;
11311152
11321153 it ( 'renders course unit details for a draft with unpublished changes' , async ( ) => {
1154+ setConfig ( {
1155+ ...getConfig ( ) ,
1156+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
1157+ } ) ;
11331158 render ( < RootWrapper /> ) ;
11341159
11351160 await waitFor ( ( ) => {
@@ -1206,6 +1231,10 @@ describe('<CourseUnit />', () => {
12061231
12071232 it ( 'should toggle visibility from sidebar and update course unit state accordingly' , async ( ) => {
12081233 const user = userEvent . setup ( ) ;
1234+ setConfig ( {
1235+ ...getConfig ( ) ,
1236+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
1237+ } ) ;
12091238 render ( < RootWrapper /> ) ;
12101239 const courseUnitSidebar = await screen . findByTestId ( 'course-unit-sidebar' ) ;
12111240
@@ -1298,6 +1327,10 @@ describe('<CourseUnit />', () => {
12981327
12991328 it ( 'should publish course unit after click on the "Publish" button' , async ( ) => {
13001329 const user = userEvent . setup ( ) ;
1330+ setConfig ( {
1331+ ...getConfig ( ) ,
1332+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
1333+ } ) ;
13011334 render ( < RootWrapper /> ) ;
13021335 let courseUnitSidebar ;
13031336 let publishBtn ;
@@ -1350,6 +1383,10 @@ describe('<CourseUnit />', () => {
13501383
13511384 it ( 'should discard changes after click on the Discard changes button' , async ( ) => {
13521385 const user = userEvent . setup ( ) ;
1386+ setConfig ( {
1387+ ...getConfig ( ) ,
1388+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
1389+ } ) ;
13531390 render ( < RootWrapper /> ) ;
13541391 let courseUnitSidebar ;
13551392 let discardChangesBtn ;
@@ -1425,6 +1462,10 @@ describe('<CourseUnit />', () => {
14251462 } ) ;
14261463
14271464 it ( 'should toggle visibility from header configure modal and update course unit state accordingly' , async ( ) => {
1465+ setConfig ( {
1466+ ...getConfig ( ) ,
1467+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
1468+ } ) ;
14281469 const user = userEvent . setup ( ) ;
14291470 render ( < RootWrapper /> ) ;
14301471 expect (
@@ -1524,6 +1565,13 @@ describe('<CourseUnit />', () => {
15241565 } ) ;
15251566
15261567 describe ( 'Copy paste functionality' , ( ) => {
1568+ beforeEach ( ( ) => {
1569+ setConfig ( {
1570+ ...getConfig ( ) ,
1571+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
1572+ } ) ;
1573+ } ) ;
1574+
15271575 it ( 'should copy a unit, paste it as a new unit, and update the course section vertical data' , async ( ) => {
15281576 const user = userEvent . setup ( ) ;
15291577 render ( < RootWrapper /> ) ;
@@ -2320,17 +2368,31 @@ describe('<CourseUnit />', () => {
23202368 } ) ;
23212369 } ) ;
23222370
2323- it ( 'should display visibility modal correctly' , async ( ) => (
2324- checkRenderVisibilityModal ( 'libraryContentAccess' )
2325- ) ) ;
2371+ it ( 'should display visibility modal correctly' , async ( ) => {
2372+ setConfig ( {
2373+ ...getConfig ( ) ,
2374+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
2375+ } ) ;
2376+ await checkRenderVisibilityModal ( 'libraryContentAccess' ) ;
2377+ } ) ;
23262378
2327- it ( 'opens legacy edit modal on edit button click' , checkLegacyEditModalOnEditMessage ) ;
2379+ it ( 'opens legacy edit modal on edit button click' , async ( ) => {
2380+ setConfig ( {
2381+ ...getConfig ( ) ,
2382+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
2383+ } ) ;
2384+ await checkLegacyEditModalOnEditMessage ( ) ;
2385+ } ) ;
23282386 } ) ;
23292387
23302388 describe ( 'Split Test Content page' , ( ) => {
23312389 const newUnitId = '12345' ;
23322390
23332391 beforeEach ( async ( ) => {
2392+ setConfig ( {
2393+ ...getConfig ( ) ,
2394+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
2395+ } ) ;
23342396 axiosMock
23352397 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
23362398 . reply ( 200 , {
@@ -2524,6 +2586,7 @@ describe('<CourseUnit />', () => {
25242586 setConfig ( {
25252587 ...getConfig ( ) ,
25262588 ENABLE_TAGGING_TAXONOMY_PAGES : 'true' ,
2589+ ENABLE_UNIT_PAGE_NEW_DESIGN : false ,
25272590 } ) ;
25282591 render ( < RootWrapper /> ) ;
25292592
0 commit comments