File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -2359,4 +2359,39 @@ describe('<CourseUnit />', () => {
2359
2359
) . not . toBeInTheDocument ( ) ;
2360
2360
} ) ;
2361
2361
} ) ;
2362
+
2363
+ it ( 'resets XBlock publish state after saving XBlock changes' , async ( ) => {
2364
+ store = initializeStore ( ) ;
2365
+ mockedUsedNavigate . mockClear ( ) ;
2366
+
2367
+ axiosMock
2368
+ . onGet ( getCourseSectionVerticalApiUrl ( blockId ) )
2369
+ . reply ( 200 , {
2370
+ ...courseSectionVerticalMock ,
2371
+ xblock_info : {
2372
+ ...courseSectionVerticalMock . xblock_info ,
2373
+ published : true , // Must have been published before
2374
+ has_changes : true , // And now have changes
2375
+ } ,
2376
+ } ) ;
2377
+
2378
+ render ( < RootWrapper /> ) ;
2379
+
2380
+ const xblocksIframe = await screen . findByTitle ( xblockContainerIframeMessages . xblockIframeTitle . defaultMessage ) ;
2381
+ expect ( xblocksIframe ) . toBeInTheDocument ( ) ;
2382
+
2383
+ const courseUnitSidebar = await screen . findByTestId ( 'course-unit-sidebar' ) ;
2384
+
2385
+ await waitFor ( ( ) => {
2386
+ // Verify the publish button is present (indicates unpublished changes)
2387
+ expect ( within ( courseUnitSidebar )
2388
+ . getByRole ( 'button' , { name : sidebarMessages . actionButtonPublishTitle . defaultMessage } )
2389
+ ) . toBeInTheDocument ( ) ;
2390
+
2391
+ // Verify discard changes button is present (confirms unpublished changes)
2392
+ expect ( within ( courseUnitSidebar )
2393
+ . getByRole ( 'button' , { name : sidebarMessages . actionButtonDiscardChangesTitle . defaultMessage } )
2394
+ ) . toBeInTheDocument ( ) ;
2395
+ } ) ;
2396
+ } ) ;
2362
2397
} ) ;
You can’t perform that action at this time.
0 commit comments