Skip to content

fix: open editor when invideoquiz component added to unit#75

Merged
djoseph-apphelix merged 2 commits intorelease-ulmofrom
djoseph-apphelix/TNL2-543
Mar 6, 2026
Merged

fix: open editor when invideoquiz component added to unit#75
djoseph-apphelix merged 2 commits intorelease-ulmofrom
djoseph-apphelix/TNL2-543

Conversation

@djoseph-apphelix
Copy link
Member

@djoseph-apphelix djoseph-apphelix commented Feb 24, 2026

Description

  • When adding an in-video quiz from the Advanced component menu, the MFE editor now opens immediately after creation instead of staying on the unit page
  • Added invideoquiz to COMPONENT_TYPES constants
  • Inside the advanced case in AddComponent.tsx, invideoquiz is now created with a callback that opens the editor modal (same pattern as problem, html, games)

Impacted users

This impacts course authors and instructors — anyone with Studio editing access who adds in-video quiz components to units. Specifically:

  • Course Staff
  • Course Admins/Instructors
  • Global Staff

Screen recording

Screen.Recording.2026-02-24.at.11.05.13.AM.mov

Supporting information

Jira ticket:
TNL2-543

Testing instructions

  • Navigate to a Unit page in Studio
  • Click "Add Component" > Advanced > In-Video Quiz
  • Verify the InVideoQuiz editor opens immediately after the component is created
  • Verify other advanced components still behave as before (no editor opens)

Copilot AI review requested due to automatic review settings February 24, 2026 07:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 invideoquiz to COMPONENT_TYPES constants 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.

Copilot AI review requested due to automatic review settings March 6, 2026 04:58
@djoseph-apphelix djoseph-apphelix force-pushed the djoseph-apphelix/TNL2-543 branch from e31590e to 1dcc99f Compare March 6, 2026 04:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +394 to +401
handleCreateNewCourseXBlockMock.mockImplementation((_params, callback) => {
if (callback) {
callback({ courseKey: 'course-v1:test', locator: 'block-v1:test+invideoquiz' });
}
});

const user = userEvent.setup();
const { getByRole } = renderComponent();
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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();

Copilot uses AI. Check for mistakes.
@djoseph-apphelix djoseph-apphelix merged commit f739a74 into release-ulmo Mar 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants