Skip to content

Commit 89e06ba

Browse files
rtibblesbotclaude
andcommitted
Add associate interaction editor and register the plugin
Registering the descriptor does not populate QUESTION_TYPE_LABELS, so QTIItemEditor gets an explicit ASSOCIATE entry — without it every associate item's view-mode header reads "Unknown type". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 2214bbc commit 89e06ba

6 files changed

Lines changed: 1503 additions & 2 deletions

File tree

‎contentcuration/contentcuration/frontend/shared/views/QTIEditor/components/QTIItemEditor/__tests__/QTIItemEditor.spec.js‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import VueRouter from 'vue-router';
33
import QTIItemEditor from '../index.vue';
44
import { qtiEditorStrings } from '../../../qtiEditorStrings';
55
import { AssessmentItemTypes } from '../../../constants';
6+
import { VALID_ASSOCIATE_ITEM_DOCUMENT } from '../../../utils/testingFixtures';
67

78
jest.mock('shared/views/TipTapEditor/TipTapEditor/TipTapEditor');
89
jest.mock('kolibri-design-system/lib/composables/useKResponsiveWindow', () => {
@@ -13,7 +14,13 @@ jest.mock('kolibri-design-system/lib/composables/useKResponsiveWindow', () => {
1314
};
1415
});
1516

16-
const { closeBtnLabel$, questionContentPlaceholder$ } = qtiEditorStrings;
17+
const {
18+
closeBtnLabel$,
19+
questionContentPlaceholder$,
20+
associateLabel$,
21+
unknownTypeLabel$,
22+
responsePoolLabel$,
23+
} = qtiEditorStrings;
1724

1825
const defaultProps = {
1926
item: {
@@ -77,6 +84,29 @@ describe('QTIItemEditor', () => {
7784
});
7885
});
7986

87+
describe('associate interaction', () => {
88+
const renderAssociateItem = () =>
89+
renderComponent({
90+
item: {
91+
assessment_id: 'test-item-id',
92+
type: AssessmentItemTypes.QTI,
93+
raw_data: VALID_ASSOCIATE_ITEM_DOCUMENT,
94+
},
95+
});
96+
97+
test('names the associate question type rather than falling back to unknown', async () => {
98+
renderAssociateItem();
99+
expect(await screen.findByText(new RegExp(associateLabel$()))).toBeInTheDocument();
100+
expect(screen.queryByText(new RegExp(unknownTypeLabel$()))).not.toBeInTheDocument();
101+
});
102+
103+
test('renders the associate editor for the parsed interaction', async () => {
104+
renderAssociateItem();
105+
expect(await screen.findByText(responsePoolLabel$())).toBeInTheDocument();
106+
expect(screen.getByText('Antonio')).toBeInTheDocument();
107+
});
108+
});
109+
80110
describe('toolbarActions slot', () => {
81111
test('renders content injected into the toolbarActions slot', () => {
82112
renderComponent({}, { toolbarActions: '<button>Edit</button>' });

‎contentcuration/contentcuration/frontend/shared/views/QTIEditor/components/QTIItemEditor/index.vue‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
[QuestionType.TEXT_ENTRY]: qtiEditorStrings.textEntryLabel$,
133133
[QuestionType.FREE_RESPONSE]: qtiEditorStrings.freeResponseLabel$,
134134
[QuestionType.ORDERING]: qtiEditorStrings.orderingLabel$,
135+
[QuestionType.ASSOCIATE]: qtiEditorStrings.associateLabel$,
135136
};
136137
return (QUESTION_TYPE_LABELS[type] ?? unknownTypeLabel$)();
137138
});

0 commit comments

Comments
 (0)