Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Prompts, choices, items and hints are edited in `TipTapEditor` with `format="htm
> [!IMPORTANT]
> In `parse`, read any field TipTap loads as HTML with `getContentHTML` (or `getPromptHTML`) from `serialization/xml.js`, never `innerHTML` or `XMLSerializer`. XML serialization self-closes empty elements (`<span data-latex="…"/>`); the HTML parser doesn't treat `/>` as closing, so everything after it is nested inside and lost.
>
> On build, pass the HTML to `buildXmlNode({ innerHTML })`, which parses it as HTML and re-creates it as XML.
> On build, pass the HTML to `buildXmlNode({ innerHTML })`, which parses it as HTML and re-creates it as XML. Stored MathML travels through TipTap in `span[data-mathml]`; pasted carriers keep LaTeX or text instead.
List the HTML fields and their editor modes in the interaction descriptor's `richTextFields`. `isEditableItem` checks them against the TipTap schema; a lossy field makes the item read-only without suppressing `validateQtiItem` errors.

> [!NOTE]
> A node view that shows itself as selected, like the inline choice chip, uses `--brand-secondary-v100`, the background of KDS's global `::selection`, with `--tokens-text` for its text.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ afterAll(() => {
});

describe('QTIEditor', () => {
it('enables Edit on the first render of a list of editable rich-text questions', () => {
const raw_data = VALID_CHOICE_ITEM_DOCUMENT.replace('Pick one.', '<strong>Pick one.</strong>');
renderComponent(
Array.from({ length: 24 }, (_, index) => ({
...QTI_ITEM,
raw_data,
assessment_id: `question-${index}`,
})),
);
const editActions = screen.getAllByRole('button', { name: toolbarLabelEdit$() });
expect(editActions).toHaveLength(24);
editActions.forEach(action => expect(action).toBeEnabled());
});

describe('opening a question', () => {
it('opens a question from its Edit action', async () => {
renderComponent([QTI_ITEM]);
Expand Down
Loading
Loading