@@ -178,7 +178,7 @@ describe('<CourseUnit />', () => {
178178 const currentSubSectionName = courseSectionVerticalMock . xblock_info . ancestor_info . ancestors [ 1 ] . display_name ;
179179
180180 const unitHeaderTitle = await screen . findByTestId ( 'unit-header-title' ) ;
181- expect ( await screen . findByText ( unitDisplayName ) ) . toBeInTheDocument ( ) ;
181+ expect ( within ( unitHeaderTitle ) . getByText ( unitDisplayName ) ) . toBeInTheDocument ( ) ;
182182 expect ( within ( unitHeaderTitle ) . getByRole ( 'button' , { name : headerTitleMessages . altButtonEdit . defaultMessage } ) )
183183 . toBeInTheDocument ( ) ;
184184 expect ( within ( unitHeaderTitle ) . getByRole ( 'button' , { name : headerTitleMessages . altButtonSettings . defaultMessage } ) )
@@ -286,7 +286,7 @@ describe('<CourseUnit />', () => {
286286 } ,
287287 } ) ;
288288
289- const courseUnitSidebar = await screen . findByTestId ( 'course-unit- sidebar') ;
289+ const courseUnitSidebar = screen . getByTestId ( ' sidebar') ;
290290 expect (
291291 within ( courseUnitSidebar ) . getByText ( legacySidebarMessages . sidebarTitleDraftUnpublishedChanges . defaultMessage ) ,
292292 ) . toBeInTheDocument ( ) ;
@@ -318,7 +318,7 @@ describe('<CourseUnit />', () => {
318318 } ,
319319 } ) ;
320320
321- const courseUnitSidebar = await screen . findByTestId ( 'course-unit- sidebar') ;
321+ const courseUnitSidebar = screen . getByTestId ( ' sidebar') ;
322322 expect (
323323 within ( courseUnitSidebar ) . getByText ( legacySidebarMessages . sidebarTitleDraftUnpublishedChanges . defaultMessage ) ,
324324 ) . toBeInTheDocument ( ) ;
@@ -1200,7 +1200,7 @@ describe('<CourseUnit />', () => {
12001200 it ( 'should toggle visibility from sidebar and update course unit state accordingly' , async ( ) => {
12011201 const user = userEvent . setup ( ) ;
12021202 render ( < RootWrapper /> ) ;
1203- const courseUnitSidebar = await screen . findByTestId ( 'course-unit- sidebar' ) ;
1203+ const courseUnitSidebar = await screen . findByTestId ( 'sidebar' ) ;
12041204
12051205 const draftUnpublishedChangesHeading = await within ( courseUnitSidebar )
12061206 . findByText ( legacySidebarMessages . sidebarTitleDraftUnpublishedChanges . defaultMessage ) ;
@@ -1296,7 +1296,7 @@ describe('<CourseUnit />', () => {
12961296 let publishBtn ;
12971297
12981298 await waitFor ( async ( ) => {
1299- courseUnitSidebar = screen . getByTestId ( 'course-unit- sidebar' ) ;
1299+ courseUnitSidebar = screen . getByTestId ( 'sidebar' ) ;
13001300 publishBtn = within ( courseUnitSidebar ) . queryByRole ( 'button' , {
13011301 name : legacySidebarMessages . actionButtonPublishTitle . defaultMessage ,
13021302 } ) ;
@@ -1348,7 +1348,7 @@ describe('<CourseUnit />', () => {
13481348 let discardChangesBtn ;
13491349
13501350 await waitFor ( async ( ) => {
1351- courseUnitSidebar = screen . getByTestId ( 'course-unit- sidebar' ) ;
1351+ courseUnitSidebar = screen . getByTestId ( 'sidebar' ) ;
13521352
13531353 const draftUnpublishedChangesHeading = within ( courseUnitSidebar )
13541354 . getByText ( legacySidebarMessages . sidebarTitleDraftUnpublishedChanges . defaultMessage ) ;
@@ -1421,7 +1421,7 @@ describe('<CourseUnit />', () => {
14211421 const user = userEvent . setup ( ) ;
14221422 render ( < RootWrapper /> ) ;
14231423 expect (
1424- await within ( await screen . findByTestId ( 'course-unit- sidebar' ) )
1424+ await within ( await screen . findByTestId ( 'sidebar' ) )
14251425 . findByLabelText ( unitInfoMessages . visibilityCheckboxTitle . defaultMessage ) ,
14261426 ) . not . toBeChecked ( ) ;
14271427
@@ -1481,15 +1481,15 @@ describe('<CourseUnit />', () => {
14811481 await user . click ( modalSaveBtn ) ;
14821482
14831483 expect (
1484- await within ( await screen . findByTestId ( 'course-unit- sidebar' ) )
1484+ await within ( await screen . findByTestId ( 'sidebar' ) )
14851485 . findByLabelText ( unitInfoMessages . visibilityCheckboxTitle . defaultMessage ) ,
14861486 ) . toBeChecked ( ) ;
14871487 expect (
1488- await within ( await screen . findByTestId ( 'course-unit- sidebar' ) )
1488+ await within ( await screen . findByTestId ( 'sidebar' ) )
14891489 . findByText ( legacySidebarMessages . sidebarTitleVisibleToStaffOnly . defaultMessage ) ,
14901490 ) . toBeInTheDocument ( ) ;
14911491 expect (
1492- await within ( await screen . findByTestId ( 'course-unit- sidebar' ) )
1492+ await within ( await screen . findByTestId ( 'sidebar' ) )
14931493 . findByText ( unitInfoMessages . visibilityStaffOnlyTitle . defaultMessage ) ,
14941494 ) . toBeInTheDocument ( ) ;
14951495 } ) ;
@@ -2217,40 +2217,6 @@ describe('<CourseUnit />', () => {
22172217 } ) ;
22182218 } ;
22192219
2220- const checkRenderVisibilityModal = async ( headingMessageId ) => {
2221- const user = userEvent . setup ( ) ;
2222- const { findByRole, getByTestId } = render ( < RootWrapper /> ) ;
2223- let configureModal ;
2224- let restrictAccessSelect ;
2225-
2226- const headerConfigureBtn = await findByRole ( 'button' , { name : / s e t t i n g s / i } ) ;
2227- await user . click ( headerConfigureBtn ) ;
2228-
2229- await waitFor ( ( ) => {
2230- configureModal = getByTestId ( 'configure-modal' ) ;
2231- restrictAccessSelect = within ( configureModal )
2232- . getByRole ( 'combobox' , { name : configureModalMessages . restrictAccessTo . defaultMessage } ) ;
2233- expect (
2234- within ( configureModal )
2235- . getByRole ( 'heading' , { name : configureModalMessages [ headingMessageId ] . defaultMessage } ) ,
2236- ) . toBeInTheDocument ( ) ;
2237- expect (
2238- within ( configureModal )
2239- . queryByText ( configureModalMessages . unitVisibility . defaultMessage ) ,
2240- ) . not . toBeInTheDocument ( ) ;
2241- expect (
2242- within ( configureModal )
2243- . getByText ( configureModalMessages . restrictAccessTo . defaultMessage ) ,
2244- ) . toBeInTheDocument ( ) ;
2245- expect ( restrictAccessSelect ) . toBeInTheDocument ( ) ;
2246- expect ( restrictAccessSelect ) . toHaveValue ( '-1' ) ;
2247- } ) ;
2248-
2249- const modalSaveBtn = within ( configureModal )
2250- . getByRole ( 'button' , { name : configureModalMessages . saveButton . defaultMessage } ) ;
2251- await user . click ( modalSaveBtn ) ;
2252- } ;
2253-
22542220 describe ( 'Library Content page' , ( ) => {
22552221 const newUnitId = '12345' ;
22562222
@@ -2313,10 +2279,6 @@ describe('<CourseUnit />', () => {
23132279 } ) ;
23142280 } ) ;
23152281
2316- it ( 'should display visibility modal correctly' , async ( ) => (
2317- checkRenderVisibilityModal ( 'libraryContentAccess' )
2318- ) ) ;
2319-
23202282 it ( 'opens legacy edit modal on edit button click' , checkLegacyEditModalOnEditMessage ) ;
23212283 } ) ;
23222284
@@ -2389,7 +2351,7 @@ describe('<CourseUnit />', () => {
23892351
23902352 await waitFor ( ( ) => {
23912353 const unitHeaderTitle = screen . getByTestId ( 'unit-header-title' ) ;
2392- expect ( screen . getByText ( unitDisplayName ) ) . toBeInTheDocument ( ) ;
2354+ expect ( within ( unitHeaderTitle ) . getByText ( unitDisplayName ) ) . toBeInTheDocument ( ) ;
23932355 expect ( within ( unitHeaderTitle ) . getByRole ( 'button' , { name : headerTitleMessages . altButtonEdit . defaultMessage } ) )
23942356 . toBeInTheDocument ( ) ;
23952357 expect (
@@ -2470,10 +2432,6 @@ describe('<CourseUnit />', () => {
24702432 } ) ;
24712433 } ) ;
24722434
2473- it ( 'should display visibility modal correctly' , async ( ) => (
2474- checkRenderVisibilityModal ( 'splitTestAccess' )
2475- ) ) ;
2476-
24772435 it ( 'opens legacy edit modal on edit button click' , checkLegacyEditModalOnEditMessage ) ;
24782436 } ) ;
24792437
@@ -2547,7 +2505,7 @@ describe('<CourseUnit />', () => {
25472505 expect ( editButton ) . toBeEnabled ( ) ;
25482506
25492507 // The "Publish" button should still be enabled
2550- const courseUnitSidebar = screen . getByTestId ( 'course-unit- sidebar' ) ;
2508+ const courseUnitSidebar = screen . getByTestId ( 'sidebar' ) ;
25512509 const publishButton = within ( courseUnitSidebar ) . getByRole (
25522510 'button' ,
25532511 { name : legacySidebarMessages . actionButtonPublishTitle . defaultMessage } ,
@@ -2559,11 +2517,7 @@ describe('<CourseUnit />', () => {
25592517 expect ( screen . queryByText ( addComponentMessages . title . defaultMessage ) ) . not . toBeInTheDocument ( ) ;
25602518 } ) ;
25612519
2562- it ( 'renders new unit info/settings sidebar' , async ( ) => {
2563- setConfig ( {
2564- ...getConfig ( ) ,
2565- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2566- } ) ;
2520+ it ( 'renders unit info/settings sidebar' , async ( ) => {
25672521 const user = userEvent . setup ( ) ;
25682522 render ( < RootWrapper /> ) ;
25692523
@@ -2588,10 +2542,6 @@ describe('<CourseUnit />', () => {
25882542 } ) ;
25892543
25902544 it ( 'displays the live state in the status bar' , async ( ) => {
2591- setConfig ( {
2592- ...getConfig ( ) ,
2593- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2594- } ) ;
25952545 axiosMock
25962546 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
25972547 . reply ( 200 , {
@@ -2684,11 +2634,6 @@ describe('<CourseUnit />', () => {
26842634 } ) ;
26852635
26862636 it ( 'displays the staff only state in the status bar' , async ( ) => {
2687- setConfig ( {
2688- ...getConfig ( ) ,
2689- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2690- } ) ;
2691-
26922637 axiosMock
26932638 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
26942639 . reply ( 200 , {
@@ -2708,10 +2653,6 @@ describe('<CourseUnit />', () => {
27082653
27092654 it ( 'should disable discussions in the settings sidebar' , async ( ) => {
27102655 const user = userEvent . setup ( ) ;
2711- setConfig ( {
2712- ...getConfig ( ) ,
2713- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2714- } ) ;
27152656 render ( < RootWrapper /> ) ;
27162657
27172658 axiosMock
@@ -2756,11 +2697,6 @@ describe('<CourseUnit />', () => {
27562697
27572698 it ( 'should update the group access in the unit sidebar' , async ( ) => {
27582699 const user = userEvent . setup ( ) ;
2759-
2760- setConfig ( {
2761- ...getConfig ( ) ,
2762- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2763- } ) ;
27642700 render ( < RootWrapper /> ) ;
27652701
27662702 axiosMock
@@ -2836,10 +2772,6 @@ describe('<CourseUnit />', () => {
28362772 } ) ;
28372773
28382774 it ( 'should one group in the visibility field in the unit sidebar' , async ( ) => {
2839- setConfig ( {
2840- ...getConfig ( ) ,
2841- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2842- } ) ;
28432775 render ( < RootWrapper /> ) ;
28442776
28452777 axiosMock
@@ -2891,10 +2823,6 @@ describe('<CourseUnit />', () => {
28912823 } ) ;
28922824
28932825 it ( 'should multiple groups in the visibility field in the unit sidebar' , async ( ) => {
2894- setConfig ( {
2895- ...getConfig ( ) ,
2896- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2897- } ) ;
28982826 render ( < RootWrapper /> ) ;
28992827
29002828 axiosMock
@@ -2951,10 +2879,6 @@ describe('<CourseUnit />', () => {
29512879 } ) ;
29522880
29532881 it ( 'should render never published state in the unit sidebar' , async ( ) => {
2954- setConfig ( {
2955- ...getConfig ( ) ,
2956- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2957- } ) ;
29582882 render ( < RootWrapper /> ) ;
29592883
29602884 axiosMock
@@ -2981,10 +2905,6 @@ describe('<CourseUnit />', () => {
29812905 } ) ;
29822906
29832907 it ( 'displays the scheduled state in the status bar' , async ( ) => {
2984- setConfig ( {
2985- ...getConfig ( ) ,
2986- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
2987- } ) ;
29882908 axiosMock
29892909 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
29902910 . reply ( 200 , {
@@ -3001,10 +2921,6 @@ describe('<CourseUnit />', () => {
30012921 } ) ;
30022922
30032923 it ( 'displays the draft changes state in the status bar' , async ( ) => {
3004- setConfig ( {
3005- ...getConfig ( ) ,
3006- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
3007- } ) ;
30082924 axiosMock
30092925 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
30102926 . reply ( 200 , {
@@ -3021,10 +2937,6 @@ describe('<CourseUnit />', () => {
30212937 } ) ;
30222938
30232939 it ( 'displays discussions enabled label in the status bar' , async ( ) => {
3024- setConfig ( {
3025- ...getConfig ( ) ,
3026- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
3027- } ) ;
30282940 axiosMock
30292941 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
30302942 . reply ( 200 , {
@@ -3040,10 +2952,6 @@ describe('<CourseUnit />', () => {
30402952 } ) ;
30412953
30422954 it ( 'displays group access with one group in the status bar' , async ( ) => {
3043- setConfig ( {
3044- ...getConfig ( ) ,
3045- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
3046- } ) ;
30472955 axiosMock
30482956 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
30492957 . reply ( 200 , {
@@ -3087,10 +2995,6 @@ describe('<CourseUnit />', () => {
30872995 } ) ;
30882996
30892997 it ( 'displays group access with multiple groups in the status bar' , async ( ) => {
3090- setConfig ( {
3091- ...getConfig ( ) ,
3092- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
3093- } ) ;
30942998 axiosMock
30952999 . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
30963000 . reply ( 200 , {
@@ -3137,7 +3041,6 @@ describe('<CourseUnit />', () => {
31373041 setConfig ( {
31383042 ...getConfig ( ) ,
31393043 ENABLE_TAGGING_TAXONOMY_PAGES : 'true' ,
3140- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
31413044 } ) ;
31423045
31433046 render ( < RootWrapper /> ) ;
@@ -3168,11 +3071,6 @@ describe('<CourseUnit />', () => {
31683071 } ;
31693072
31703073 beforeEach ( async ( ) => {
3171- setConfig ( {
3172- ...getConfig ( ) ,
3173- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
3174- } ) ;
3175-
31763074 // The Meilisearch client-side API uses fetch, not Axios.
31773075 fetchMock . mockReset ( ) ;
31783076 fetchMock . post ( searchEndpoint , ( _url , req ) => {
@@ -3418,10 +3316,6 @@ describe('<CourseUnit />', () => {
34183316 } ) ;
34193317
34203318 it ( 'not render add sidebar in units from libraries (read-only)' , async ( ) => {
3421- setConfig ( {
3422- ...getConfig ( ) ,
3423- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
3424- } ) ;
34253319 render ( < RootWrapper /> ) ;
34263320
34273321 axiosMock
@@ -3454,15 +3348,6 @@ describe('<CourseUnit />', () => {
34543348 } ) ;
34553349
34563350 it ( 'opens the component info sidebar on postMessage event' , async ( ) => {
3457- setConfig ( {
3458- ...getConfig ( ) ,
3459- ENABLE_UNIT_PAGE_NEW_DESIGN : 'true' ,
3460- } ) ;
3461-
3462- axiosMock
3463- . onGet ( getXBlockApiUrl ( mockContentData . textXBlock ) )
3464- . reply ( 200 , mockContentData . textXBlockData ) ;
3465-
34663351 render ( < RootWrapper /> ) ;
34673352
34683353 await screen . findByTitle ( xblockContainerIframeMessages . xblockIframeTitle . defaultMessage ) ;
0 commit comments