mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
inserting newline after feedback so as to keep separate from following content
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
import { describe, it, expect } from "vitest";
|
||||||
|
import { quizQuestionMarkdownUtils } from "@/features/local/quizzes/models/utils/quizQuestionMarkdownUtils";
|
||||||
|
import { QuestionType } from "@/features/local/quizzes/models/localQuizQuestion";
|
||||||
|
|
||||||
|
describe("feedback spacing", () => {
|
||||||
|
it("adds a blank line after feedback before answers", () => {
|
||||||
|
const question = {
|
||||||
|
text: "What is 2+2?",
|
||||||
|
questionType: QuestionType.MULTIPLE_CHOICE,
|
||||||
|
points: 1,
|
||||||
|
answers: [
|
||||||
|
{ correct: true, text: "4" },
|
||||||
|
],
|
||||||
|
matchDistractors: [],
|
||||||
|
correctComments: "Good",
|
||||||
|
incorrectComments: "No",
|
||||||
|
neutralComments: "Note",
|
||||||
|
} as any;
|
||||||
|
|
||||||
|
const md = quizQuestionMarkdownUtils.toMarkdown(question as any);
|
||||||
|
|
||||||
|
// look for double newline separating feedback block and answer marker
|
||||||
|
expect(md).toMatch(/\n\n\*?a\)/);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -89,6 +89,8 @@ export const quizFeedbackMarkdownUtils = {
|
|||||||
if (neutralComments) {
|
if (neutralComments) {
|
||||||
feedbackText += `${delimiters.neutral} ${neutralComments}\n`;
|
feedbackText += `${delimiters.neutral} ${neutralComments}\n`;
|
||||||
}
|
}
|
||||||
|
// Ensure there's a blank line after feedback block so answers are separated
|
||||||
|
if (feedbackText) feedbackText += "\n";
|
||||||
return feedbackText;
|
return feedbackText;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user