From b316bc346e9f9eecc20a3184719a7237a6fee5b0 Mon Sep 17 00:00:00 2001 From: Devasia Joseph Date: Tue, 24 Feb 2026 12:33:45 +0530 Subject: [PATCH 1/2] fix: open editor when invideoquiz component added to unit --- src/course-unit/add-component/AddComponent.tsx | 14 +++++++++++++- src/generic/block-type-utils/constants.ts | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/course-unit/add-component/AddComponent.tsx b/src/course-unit/add-component/AddComponent.tsx index d08e84c099..686866c102 100644 --- a/src/course-unit/add-component/AddComponent.tsx +++ b/src/course-unit/add-component/AddComponent.tsx @@ -170,7 +170,19 @@ const AddComponent = ({ showAddLibraryContentModal(); break; case COMPONENT_TYPES.advanced: - handleCreateNewCourseXBlock({ type: moduleName, category: moduleName, parentLocator: blockId }); + if (moduleName === COMPONENT_TYPES.invideoquiz) { + handleCreateNewCourseXBlock( + { type: moduleName, category: moduleName, parentLocator: blockId }, + ({ courseKey, locator }) => { + setCourseId(courseKey); + setBlockType(moduleName); + setNewBlockId(locator); + showXBlockEditorModal(); + }, + ); + } else { + handleCreateNewCourseXBlock({ type: moduleName, category: moduleName, parentLocator: blockId }); + } break; case COMPONENT_TYPES.openassessment: handleCreateNewCourseXBlock({ boilerplate: moduleName, category: type, parentLocator: blockId }); diff --git a/src/generic/block-type-utils/constants.ts b/src/generic/block-type-utils/constants.ts index 89510bb0fb..4fcafef40b 100644 --- a/src/generic/block-type-utils/constants.ts +++ b/src/generic/block-type-utils/constants.ts @@ -39,6 +39,7 @@ export const COMPONENT_TYPES = { video: 'video', dragAndDrop: 'drag-and-drop-v2', games: 'games', + invideoquiz: 'invideoquiz', lti: 'lti_consumer', scorm: 'scorm', h5p: 'h5pxblock', From 1dcc99f3ce8557c17fae213d4009ed5251995fd8 Mon Sep 17 00:00:00 2001 From: Devasia Joseph Date: Tue, 24 Feb 2026 13:06:04 +0530 Subject: [PATCH 2/2] fix: added tests for invideoquiz modal --- .../__mocks__/courseSectionVertical.js | 8 +++++ .../add-component/AddComponent.test.tsx | 32 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/course-unit/__mocks__/courseSectionVertical.js b/src/course-unit/__mocks__/courseSectionVertical.js index 6693598e49..2bbc7ff555 100644 --- a/src/course-unit/__mocks__/courseSectionVertical.js +++ b/src/course-unit/__mocks__/courseSectionVertical.js @@ -82,6 +82,14 @@ module.exports = { tab: 'common', support_level: true, }, + { + display_name: 'In Video Quiz', + category: 'invideoquiz', + boilerplate_name: null, + hinted: false, + tab: 'common', + support_level: true, + }, ], display_name: 'Advanced', support_legend: { diff --git a/src/course-unit/add-component/AddComponent.test.tsx b/src/course-unit/add-component/AddComponent.test.tsx index a9c55b9056..54745bd193 100644 --- a/src/course-unit/add-component/AddComponent.test.tsx +++ b/src/course-unit/add-component/AddComponent.test.tsx @@ -390,6 +390,38 @@ describe('', () => { }); }); + it('calls handleCreateNewCourseXBlock with callback that opens editor when InVideoQuiz is selected from Advanced modal', async () => { + handleCreateNewCourseXBlockMock.mockImplementation((_params, callback) => { + if (callback) { + callback({ courseKey: 'course-v1:test', locator: 'block-v1:test+invideoquiz' }); + } + }); + + const user = userEvent.setup(); + const { getByRole } = renderComponent(); + const advancedButton = getByRole('button', { + name: new RegExp(`${messages.buttonText.defaultMessage} Advanced`, 'i'), + }); + + await user.click(advancedButton); + const modalContainer = getByRole('dialog'); + + const radioInput = within(modalContainer).getByRole('radio', { name: 'In Video Quiz' }); + const sendBtn = within(modalContainer).getByRole('button', { name: messages.modalBtnText.defaultMessage }); + + expect(sendBtn).toBeDisabled(); + await user.click(radioInput); + expect(sendBtn).not.toBeDisabled(); + + await user.click(sendBtn); + + expect(handleCreateNewCourseXBlockMock).toHaveBeenCalledWith({ + parentLocator: '123', + type: COMPONENT_TYPES.invideoquiz, + category: COMPONENT_TYPES.invideoquiz, + }, expect.any(Function)); + }); + it('verifies "Text" component creation and submission in modal', async () => { const user = userEvent.setup(); const { getByRole } = renderComponent();