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 @@ -94,6 +94,7 @@
v-model="answer.answer"
class="editor"
:mode="isAnswerOpen(answerIdx) ? 'edit' : 'view'"
minHeight="80px"
:imageProcessor="EditorImageProcessor"
@update="updateAnswerText($event, answerIdx)"
@minimize="emitClose"
Expand Down Expand Up @@ -164,6 +165,7 @@
v-model="answer.answer"
class="editor"
:mode="isAnswerOpen(answerIdx) ? 'edit' : 'view'"
minHeight="80px"
:imageProcessor="EditorImageProcessor"
@update="updateAnswerText($event, answerIdx)"
@minimize="emitClose"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ const clickClose = async assessmentItemWrapper => {
await assessmentItemWrapper.findComponent('[data-test="closeBtn"]').trigger('click');
};

const clickEdit = async assessmentItemWrapper => {
await assessmentItemWrapper
.findComponent(`[data-test="toolbarIcon-${AssessmentItemToolbarActions.EDIT_ITEM}"]`)
.trigger('click');
};

const clickDelete = async assessmentItemWrapper => {
await assessmentItemWrapper
.findComponent(`[data-test="toolbarMenuItem-${AssessmentItemToolbarActions.DELETE_ITEM}"]`)
Comment thread
Abhishek-Punhani marked this conversation as resolved.
Expand Down Expand Up @@ -210,6 +204,15 @@ describe('AssessmentEditor', () => {
expect(wrapper.findComponent('[data-test="showAnswersCheckbox"]').exists()).toBe(true);
});

it("wraps 'Show answers' checkbox in a page container", () => {
expect(wrapper.find('.show-answers-container').exists()).toBe(true);
});

it('renders question card headers', () => {
expect(wrapper.html()).toContain('Question 1 of 4 — Numeric input');
expect(wrapper.html()).toContain('Question 2 of 4 — Single choice');
});

it("doesn't render answers preview by default", () => {
const items = getItems(wrapper);

Expand All @@ -233,32 +236,25 @@ describe('AssessmentEditor', () => {
it('opens an item on item click', async () => {
const items = getItems(wrapper);
await items.at(1).trigger('click');
const updatedItems = getItems(wrapper);
Comment thread
Abhishek-Punhani marked this conversation as resolved.

expect(isItemOpen(items.at(0))).toBe(false);
expect(isItemOpen(items.at(1))).toBe(true);
expect(isItemOpen(items.at(2))).toBe(false);
expect(isItemOpen(items.at(3))).toBe(false);
});

it('opens an item on toolbar edit icon click', async () => {
const items = getItems(wrapper);
await clickEdit(items.at(1));

expect(isItemOpen(items.at(0))).toBe(false);
expect(isItemOpen(items.at(1))).toBe(true);
expect(isItemOpen(items.at(2))).toBe(false);
expect(isItemOpen(items.at(3))).toBe(false);
expect(isItemOpen(updatedItems.at(0))).toBe(false);
expect(isItemOpen(updatedItems.at(1))).toBe(true);
expect(isItemOpen(updatedItems.at(2))).toBe(false);
expect(isItemOpen(updatedItems.at(3))).toBe(false);
});

it('closes an item on close button click', async () => {
// open an item at first
const items = getItems(wrapper);
await items.at(1).trigger('click');
expect(isItemOpen(items.at(1))).toBe(true);
let updatedItems = getItems(wrapper);
expect(isItemOpen(updatedItems.at(1))).toBe(true);

// now close it
await clickClose(items.at(1));
expect(isItemOpen(items.at(1))).toBe(false);
await clickClose(updatedItems.at(1));
updatedItems = getItems(wrapper);
expect(isItemOpen(updatedItems.at(1))).toBe(false);
});

describe('on "Delete" click', () => {
Expand Down
Loading
Loading