Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
suryabulusu committed Nov 2, 2023
2 parents e3e5087 + b3ef2b4 commit 9aa2604
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 34 deletions.
5 changes: 1 addition & 4 deletions src/components/InstructionPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@
<div
v-for="(questionSetState, index) in questionSetStates" :key="index">
<li class="text-base mt-2 ml-7 font-semibold leading-none mr-4" :data-test="`questionSetTitle-${index}`">{{ questionSetState.title }}</li>
<div class="ml-12 mr-4 mt-1" :data-test="`no-of-questions-${index}`">
There are {{ questionSetState.paletteItems.length }} questions, out of which only {{ questionSetState.maxQuestionsAllowedToAttempt }} questions need to be attempted.
</div>
<div class="text-base mx-2 mb-4 leading-tight text-slate-500 ml-12 mr-4" :data-test="`questionSetInstruction-${index}`" v-html="questionSetState.instructionPageText"></div>
<div class="text-base mx-2 mb-4 leading-tight text-slate-500 ml-12 mr-4" :data-test="`questionSetInstruction-${index}`" v-html="questionSetState.instructionText"></div>
</div>
</div>
<!-- general Instruction -->
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ export interface questionSetPalette {
title: string | null;
paletteItems: paletteItemState[];
instructionText: string;
instructionPageText?: string;
maxQuestionsAllowedToAttempt: number;
}

Expand Down
7 changes: 2 additions & 5 deletions src/views/Player.vue
Original file line number Diff line number Diff line change
Expand Up @@ -710,20 +710,17 @@ export default defineComponent({
}
// the below instruction assumes all questions within a set are of the same type
let paletteInstructionText: string = state.questionSets[index].description ?? "";
// added instructionPageText variable for instructionPage component to not print extra information that is present in paletteInstructionText
const localInstructionPageText: string = state.questionSets[index].description ?? "";
if (state.questionSets[index].max_questions_allowed_to_attempt < state.questionSets[index].questions.length) {
paletteInstructionText += `\nYou may attempt only up to ${state.questionSets[index].max_questions_allowed_to_attempt} questions in this section.`
paletteInstructionText += `<br>You may attempt only up to ${state.questionSets[index].max_questions_allowed_to_attempt} questions in this section.`
} else {
paletteInstructionText += `\nYou may attempt all questions in this section.`
paletteInstructionText += `<br>You may attempt all questions in this section.`
}
qsetStates.push({
title: state.questionSets[index].title,
paletteItems: states,
instructionText: paletteInstructionText,
instructionPageText: localInstructionPageText,
maxQuestionsAllowedToAttempt: state.questionSets[index].max_questions_allowed_to_attempt,
})
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/renders-omr-assessment.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ describe("Player for OMR quizzes", () => {
cy.get('[data-test="questionSetInstruction-1"').should("exist");
cy.get('[data-test="questionSetInstruction-1"').should(
"have.text",
"Question Set 1 Description\nYou may attempt only up to 3 questions in this section."
"Question Set 1 DescriptionYou may attempt only up to 3 questions in this section."
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/renders-player-assessment.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ describe("Player for Assessment quizzes", () => {
cy.get('[data-test="paletteInstruction-0"').should("exist");
cy.get('[data-test="paletteInstruction-0"').should(
"have.text",
"Question Set 0 Description\nYou may attempt all questions in this section."
"Question Set 0 DescriptionYou may attempt all questions in this section."
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/renders-player-partial-marks-assessment.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe("Player for Assessment quizzes with partial marks", () => {
cy.get('[data-test="paletteInstruction-0"').should("exist");
cy.get('[data-test="paletteInstruction-0"').should(
"have.text",
"Question Set 0 Description\nYou may attempt all questions in this section."
"Question Set 0 DescriptionYou may attempt all questions in this section."
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/renders-player-to-check-optional.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("Player for Assessment quizzes", () => {
cy.get('[data-test="paletteInstruction-1"').should("exist");
cy.get('[data-test="paletteInstruction-1"').should(
"have.text",
"Question Set 1 Description\nYou may attempt only up to 3 questions in this section."
"Question Set 1 DescriptionYou may attempt only up to 3 questions in this section."
);
});

Expand Down
20 changes: 0 additions & 20 deletions tests/unit/components/InstructionPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ describe('InstructionPage', () => {
};
const testQuestionSetStates = [
{
instructionPageText: "You may attempt 2 out of 5 questions",
instructionTest: "You may attempt all the questions",
maxQuestionsAllowedToAttempt: 2,
paletteItems: [
Expand All @@ -26,7 +25,6 @@ describe('InstructionPage', () => {
title: "Maths - Set 0",
},
{
instructionPageText: "You may attempt 2 out of 5 questions",
instructionTest: "You may attempt all the questions",
maxQuestionsAllowedToAttempt: 2,
paletteItems: [
Expand Down Expand Up @@ -78,7 +76,6 @@ describe('InstructionPage', () => {
};
const testQuestionSetStates = [
{
instructionPageText: "You may attempt 2 out of 5 questions",
instructionTest: "You may attempt all the questions",
maxQuestionsAllowedToAttempt: 2,
paletteItems: [
Expand All @@ -94,7 +91,6 @@ describe('InstructionPage', () => {
title: "Maths - Set 0",
},
{
instructionPageText: "You may attempt 2 out of 5 questions",
instructionTest: "You may attempt all the questions",
maxQuestionsAllowedToAttempt: 2,
paletteItems: [
Expand Down Expand Up @@ -145,21 +141,5 @@ describe('InstructionPage', () => {
questionSetIndex = 1;
expect(wrapper.find(`[data-test="questionSetTitle-${questionSetIndex}"]`).text()).toBe("Maths - Set 1");
});

it("displays instruction text for each set", () => {
let questionSetIndex = 0;
expect(wrapper.find(`[data-test="questionSetInstruction-${questionSetIndex}"]`).text()).toBe("You may attempt 2 out of 5 questions");

questionSetIndex = 1;
expect(wrapper.find(`[data-test="questionSetInstruction-${questionSetIndex}"]`).text()).toBe("You may attempt 2 out of 5 questions");
});

it("No. of questions need to be attempted for each set", () => {
let questionSetIndex = 0;
expect(wrapper.find(`[data-test="no-of-questions-${questionSetIndex}"]`).text()).toBe("There are 2 questions, out of which only 2 questions need to be attempted.");

questionSetIndex = 1;
expect(wrapper.find(`[data-test="no-of-questions-${questionSetIndex}"]`).text()).toBe("There are 2 questions, out of which only 2 questions need to be attempted.");
})
});
});

0 comments on commit 9aa2604

Please sign in to comment.