Skip to content

Commit

Permalink
fix: change back the FormDialog submit button text
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinCupela committed Nov 1, 2024
1 parent 5d29296 commit 8174682
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/Dialog/FormDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const FormDialog = <
onClick={handleSubmit}
type='submit'
>
{title ?? t<string>('Submit')}
{t<string>('Send')}
</button>
</div>
</div>
Expand Down
11 changes: 4 additions & 7 deletions src/components/Poll/__tests__/AddCommentForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import { AddCommentForm } from '../PollActions';
import { PollProvider, TranslationProvider } from '../../../context';
import { generatePoll } from '../../../mock-builders';

const ADD_COMMENT_TEXT = 'Add a comment';
const UPDATE_COMMENT_TEXT = 'Update your comment';

const close = jest.fn();
const messageId = 'messageId';
const newlyTypedValue = 'XX';
Expand All @@ -35,15 +32,15 @@ describe('AddCommentForm', () => {
expect(input).toHaveValue(poll.data.ownAnswer.text);
const submitButton = container.querySelector('button[type="submit"]');
expect(submitButton).toBeDisabled();
expect(submitButton).toHaveTextContent(UPDATE_COMMENT_TEXT);
expect(submitButton).toHaveTextContent('Send');

act(() => {
fireEvent.change(input, { target: { value: newlyTypedValue } });
});

await waitFor(() => {
expect(submitButton).toBeEnabled();
expect(submitButton).toHaveTextContent(UPDATE_COMMENT_TEXT);
expect(submitButton).toHaveTextContent('Send');
});

act(() => {
Expand All @@ -63,13 +60,13 @@ describe('AddCommentForm', () => {
expect(input).toHaveValue('');
const submitButton = container.querySelector('button[type="submit"]');
expect(submitButton).toBeDisabled();
expect(submitButton).toHaveTextContent(ADD_COMMENT_TEXT);
expect(submitButton).toHaveTextContent('Send');
act(() => {
fireEvent.change(input, { target: { value: newlyTypedValue } });
});
await waitFor(() => {
expect(submitButton).toBeEnabled();
expect(submitButton).toHaveTextContent(ADD_COMMENT_TEXT);
expect(submitButton).toHaveTextContent('Send');
});
act(() => {
fireEvent.click(submitButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SuggestPollOptionForm } from '../PollActions';
import { ChatProvider, PollProvider, TranslationProvider } from '../../../context';
import { generatePoll } from '../../../mock-builders';

const SUBMIT_BUTTON_TEXT = 'Suggest an option';
const SUBMIT_BUTTON_TEXT = 'Send';

const close = jest.fn();
const messageId = 'messageId';
Expand Down

0 comments on commit 8174682

Please sign in to comment.