diff --git a/src/course-unit/CourseUnit.test.jsx b/src/course-unit/CourseUnit.test.jsx
index 6246e9ec3..e0ec79302 100644
--- a/src/course-unit/CourseUnit.test.jsx
+++ b/src/course-unit/CourseUnit.test.jsx
@@ -454,6 +454,37 @@ describe('', () => {
});
});
+ it('renders and navigates to the HTML XBlock editor after modifying the block type', async () => {
+ const { getByTitle } = render();
+ const updatedCourseVerticalChildrenMock = JSON.parse(JSON.stringify(courseVerticalChildrenMock));
+ const targetBlockId = updatedCourseVerticalChildrenMock.children[1].block_id;
+
+ updatedCourseVerticalChildrenMock.children = updatedCourseVerticalChildrenMock.children
+ .map((child) => (child.block_id === targetBlockId
+ ? { ...child, block_type: 'html' }
+ : child));
+
+ axiosMock
+ .onGet(getCourseVerticalChildrenApiUrl(blockId))
+ .reply(200, updatedCourseVerticalChildrenMock);
+
+ await executeThunk(fetchCourseVerticalChildrenData(blockId), store.dispatch);
+
+ await waitFor(() => {
+ const iframe = getByTitle(xblockContainerIframeMessages.xblockIframeTitle.defaultMessage);
+ expect(iframe).toBeInTheDocument();
+ simulatePostMessageEvent(messageTypes.currentXBlockId, {
+ id: targetBlockId,
+ });
+ });
+
+ waitFor(() => {
+ simulatePostMessageEvent(messageTypes.duplicateXBlock, {});
+ expect(mockedUsedNavigate)
+ .toHaveBeenCalledWith(`/course/${courseId}/editor/html/${targetBlockId}`, { replace: true });
+ });
+ });
+
it('handles CourseUnit header action buttons', async () => {
const { open } = window;
window.open = jest.fn();