From 910b83def24024308c52502aa239f4485c4291a5 Mon Sep 17 00:00:00 2001 From: "C. Fuhrman" Date: Sun, 26 Jan 2025 09:33:42 -0500 Subject: [PATCH] Rename --- .../components/GiftTemplate/TextType.test.ts | 18 +++++++++--------- .../templates/GlobalFeedbackTemplate.ts | 4 ++-- .../GiftTemplate/templates/MatchingTemplate.ts | 4 ++-- .../templates/MultipleChoiceAnswersTemplate.ts | 6 +++--- .../templates/ShortAnswerTemplate.ts | 4 ++-- .../GiftTemplate/templates/StemTemplate.ts | 4 ++-- .../GiftTemplate/templates/TextTypeTemplate.ts | 15 ++++++++++----- .../MultipleChoiceQuestionDisplay.tsx | 10 +++++----- .../NumericalQuestionDisplay.tsx | 8 ++++---- .../ShortAnswerQuestionDisplay.tsx | 6 +++--- .../TrueFalseQuestionDisplay.tsx | 10 +++++----- 11 files changed, 47 insertions(+), 42 deletions(-) diff --git a/client/src/__tests__/components/GiftTemplate/TextType.test.ts b/client/src/__tests__/components/GiftTemplate/TextType.test.ts index 40d229d..980db3c 100644 --- a/client/src/__tests__/components/GiftTemplate/TextType.test.ts +++ b/client/src/__tests__/components/GiftTemplate/TextType.test.ts @@ -1,4 +1,4 @@ -import { FormatTextTemplate } from "src/components/GiftTemplate/templates/TextTypeTemplate"; +import { FormattedTextTemplate } from "src/components/GiftTemplate/templates/TextTypeTemplate"; import { TextFormat } from "gift-pegjs"; describe('TextType', () => { @@ -8,7 +8,7 @@ describe('TextType', () => { format: 'moodle' }; const expectedOutput = 'Hello, world! 5 > 3, right?'; - expect(FormatTextTemplate(input)).toBe(expectedOutput); + expect(FormattedTextTemplate(input)).toBe(expectedOutput); }); it('should format text with newlines correctly', () => { @@ -17,7 +17,7 @@ describe('TextType', () => { format: 'plain' }; const expectedOutput = 'Hello,
world!
5 > 3, right?'; - expect(FormatTextTemplate(input)).toBe(expectedOutput); + expect(FormattedTextTemplate(input)).toBe(expectedOutput); }); it('should format text with LaTeX correctly', () => { @@ -31,7 +31,7 @@ describe('TextType', () => { // by running the test and copying the "Received string:" in jest output // when it fails (assuming the output is correct) const expectedOutput = 'E=mc2E=mc^2'; - expect(FormatTextTemplate(input)).toContain(expectedOutput); + expect(FormattedTextTemplate(input)).toContain(expectedOutput); }); it('should format text with two equations (inline and separate) correctly', () => { @@ -41,7 +41,7 @@ describe('TextType', () => { }; // hint: katex-display is the class that indicates a separate equation const expectedOutput = 'a+b=ca + b = c ? E=mc2E=mc^2'; - expect(FormatTextTemplate(input)).toContain(expectedOutput); + expect(FormattedTextTemplate(input)).toContain(expectedOutput); }); it('should format text with a katex matrix correctly', () => { @@ -51,7 +51,7 @@ describe('TextType', () => { format: 'plain' }; const expectedOutput = 'Donnez le déterminant de la matrice suivante.\\begin{pmatrix}
a&b \\\\
c&d
\\end{pmatrix}'; - expect(FormatTextTemplate(input)).toContain(expectedOutput); + expect(FormattedTextTemplate(input)).toContain(expectedOutput); }); it('should format text with Markdown correctly', () => { @@ -61,7 +61,7 @@ describe('TextType', () => { }; // TODO: investigate why the output has an extra newline const expectedOutput = 'Bold\n'; - expect(FormatTextTemplate(input)).toBe(expectedOutput); + expect(FormattedTextTemplate(input)).toBe(expectedOutput); }); it('should format text with HTML correctly', () => { @@ -70,7 +70,7 @@ describe('TextType', () => { format: 'html' }; const expectedOutput = 'yes'; - expect(FormatTextTemplate(input)).toBe(expectedOutput); + expect(FormattedTextTemplate(input)).toBe(expectedOutput); }); it('should format plain text correctly', () => { @@ -79,7 +79,7 @@ describe('TextType', () => { format: 'plain' }; const expectedOutput = 'Just plain text'; - expect(FormatTextTemplate(input)).toBe(expectedOutput); + expect(FormattedTextTemplate(input)).toBe(expectedOutput); }); // Add more tests for other formats if needed diff --git a/client/src/components/GiftTemplate/templates/GlobalFeedbackTemplate.ts b/client/src/components/GiftTemplate/templates/GlobalFeedbackTemplate.ts index e5e4e78..faa0cea 100644 --- a/client/src/components/GiftTemplate/templates/GlobalFeedbackTemplate.ts +++ b/client/src/components/GiftTemplate/templates/GlobalFeedbackTemplate.ts @@ -1,5 +1,5 @@ import { TemplateOptions } from './types'; -import {FormatTextTemplate} from './TextTypeTemplate'; +import {FormattedTextTemplate} from './TextTypeTemplate'; import { state } from '.'; import { theme } from '../constants'; import { TextFormat } from 'gift-pegjs'; @@ -20,7 +20,7 @@ export default function GlobalFeedbackTemplate({ format, text }: GlobalFeedbackO return (format && text) ? `
-

${FormatTextTemplate({format: format, text: text})}

+

${FormattedTextTemplate({format: format, text: text})}

` : ``; } diff --git a/client/src/components/GiftTemplate/templates/MatchingTemplate.ts b/client/src/components/GiftTemplate/templates/MatchingTemplate.ts index a661c87..f03671b 100644 --- a/client/src/components/GiftTemplate/templates/MatchingTemplate.ts +++ b/client/src/components/GiftTemplate/templates/MatchingTemplate.ts @@ -1,7 +1,7 @@ import { TemplateOptions } from './types'; import QuestionContainer from './QuestionContainerTemplate'; import Title from './TitleTemplate'; -import {FormatTextTemplate} from './TextTypeTemplate'; +import {FormattedTextTemplate} from './TextTypeTemplate'; import GlobalFeedback from './GlobalFeedbackTemplate'; import { ParagraphStyle, SelectStyle } from '../constants'; import { state } from '.'; @@ -67,7 +67,7 @@ function MatchAnswers({ choices }: MatchAnswerOptions): string { .map(({ formattedSubquestion }) => { return `
- ${FormatTextTemplate(formattedSubquestion)} + ${FormattedTextTemplate(formattedSubquestion)}