From e409a7cea803f8b1a89d64618bb711021e50ed39 Mon Sep 17 00:00:00 2001 From: Raymond Luong Date: Thu, 17 Oct 2024 16:40:12 -0600 Subject: [PATCH] Fix stories --- .../checking-comment-form.stories.ts | 24 +++++++++++++++---- .../src/assets/i18n/checking_en.json | 1 - 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking-answers/checking-comments/checking-comment-form/checking-comment-form.stories.ts b/src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking-answers/checking-comments/checking-comment-form/checking-comment-form.stories.ts index 734eaccc73..514201bc3f 100644 --- a/src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking-answers/checking-comments/checking-comment-form/checking-comment-form.stories.ts +++ b/src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking-answers/checking-comments/checking-comment-form/checking-comment-form.stories.ts @@ -4,12 +4,20 @@ import { expect } from '@storybook/jest'; import { userEvent, within } from '@storybook/testing-library'; import { I18nStoryModule } from 'xforge-common/i18n-story.module'; import { UICommonModule } from 'xforge-common/ui-common.module'; +import { AttachAudioComponent } from '../../../../attach-audio/attach-audio.component'; +import { TextAndAudioComponent } from '../../../../text-and-audio/text-and-audio.component'; +import { CheckingAudioRecorderComponent } from '../../../checking-audio-recorder/checking-audio-recorder.component'; import { CheckingCommentFormComponent } from './checking-comment-form.component'; const meta: Meta = { title: 'Checking/Comments/Comment Form', component: CheckingCommentFormComponent, - decorators: [moduleMetadata({ imports: [CommonModule, UICommonModule, I18nStoryModule] })] + decorators: [ + moduleMetadata({ + imports: [CommonModule, UICommonModule, I18nStoryModule], + declarations: [TextAndAudioComponent, AttachAudioComponent, CheckingAudioRecorderComponent] + }) + ] }; export default meta; @@ -24,7 +32,16 @@ export const NewForm: Story = { }; export const EditForm: Story = { - args: { text: 'This is a comment' }, + args: { + comment: { + dataId: 'c01', + ownerRef: 'user01', + text: 'This is a comment', + deleted: false, + dateCreated: '', + dateModified: '' + } + }, parameters: { // Disabled for the same reason the story above chromatic: { disableSnapshot: true } @@ -32,14 +49,13 @@ export const EditForm: Story = { }; export const InvalidForm: Story = { - args: { text: '' }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); // Only necessary because the autofocus directive has to use setTimeout await new Promise(resolve => setTimeout(resolve, 0)); const saveButton: HTMLElement = canvas.getByRole('button', { name: /Save/i }); await userEvent.click(saveButton); - const error: HTMLElement = canvas.getByText(/You need to enter your comment before saving/i); + const error: HTMLElement = canvas.getByText(/Provide text or audio before saving/i); expect(error).toBeInTheDocument(); } }; diff --git a/src/SIL.XForge.Scripture/ClientApp/src/assets/i18n/checking_en.json b/src/SIL.XForge.Scripture/ClientApp/src/assets/i18n/checking_en.json index f7c40fdae5..ed2003c95e 100644 --- a/src/SIL.XForge.Scripture/ClientApp/src/assets/i18n/checking_en.json +++ b/src/SIL.XForge.Scripture/ClientApp/src/assets/i18n/checking_en.json @@ -266,7 +266,6 @@ }, "checking_comment_form": { "cancel": "Cancel", - "comment_cannot_be_blank": "You need to enter your comment before saving", "save_comment": "Save comment", "your_comment": "Your comment" },