fix: open editor when invideoquiz component added to unit#75
fix: open editor when invideoquiz component added to unit#75djoseph-apphelix merged 2 commits intorelease-ulmofrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for opening the editor modal immediately when an in-video quiz component is created from the Advanced component menu, aligning its behavior with other interactive components like problem, html, and games.
Changes:
- Added
invideoquiztoCOMPONENT_TYPESconstants for consistent reference throughout the codebase - Modified the advanced component creation logic to open the editor modal for invideoquiz components using a callback pattern
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/generic/block-type-utils/constants.ts | Added invideoquiz constant to COMPONENT_TYPES object for type-safe reference |
| src/course-unit/add-component/AddComponent.tsx | Added conditional logic to open editor modal when invideoquiz is created, following the same pattern as problem/games/html components |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e31590e to
1dcc99f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| handleCreateNewCourseXBlockMock.mockImplementation((_params, callback) => { | ||
| if (callback) { | ||
| callback({ courseKey: 'course-v1:test', locator: 'block-v1:test+invideoquiz' }); | ||
| } | ||
| }); | ||
|
|
||
| const user = userEvent.setup(); | ||
| const { getByRole } = renderComponent(); |
There was a problem hiding this comment.
This test overrides handleCreateNewCourseXBlockMock with mockImplementation and invokes the callback, but never restores the original behavior. Since the same mock is reused across tests (and the suite doesn’t clear mocks in beforeEach), this implementation can leak into later tests and trigger unexpected editor rendering/state updates. Use mockImplementationOnce (or reset/clear the mock in beforeEach/afterEach) and avoid calling the callback unless the test asserts the resulting UI/state.
| handleCreateNewCourseXBlockMock.mockImplementation((_params, callback) => { | |
| if (callback) { | |
| callback({ courseKey: 'course-v1:test', locator: 'block-v1:test+invideoquiz' }); | |
| } | |
| }); | |
| const user = userEvent.setup(); | |
| const { getByRole } = renderComponent(); | |
| handleCreateNewCourseXBlockMock.mockImplementationOnce((_params, _callback) => { | |
| // Intentionally left blank: this test only asserts that a callback is passed, | |
| // it does not depend on invoking the callback or its side effects. | |
| }); | |
| const user = userEvent.setup(); | |
| const { getByRole } = renderComponent(); | |
| const { getByRole } = renderComponent(); |
Description
Impacted users
This impacts course authors and instructors — anyone with Studio editing access who adds in-video quiz components to units. Specifically:
Screen recording
Screen.Recording.2026-02-24.at.11.05.13.AM.mov
Supporting information
Jira ticket:
TNL2-543
Testing instructions