Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/Dialog/FormDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const FormDialog = <
<button
className='str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel'
onClick={close}
type='button'
>
{t('Cancel')}
</button>
Expand Down
1 change: 1 addition & 0 deletions src/components/MessageInput/EditMessageForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const EditMessageForm = () => {
className='str-chat__edit-message-cancel'
data-testid='cancel-button'
onClick={cancel}
type='button'
>
{t('Cancel')}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ describe('MessageInput in Thread', () => {
customClient,
});
expect(getDraftSpy).toHaveBeenCalledTimes(1);
await act(() => {
customClient.setMessageComposerSetupFunction(({ composer }) => {
composer.updateConfig({ drafts: { enabled: false } });
});
});
});
it('prevents querying if composition is not empty', async () => {
const { customChannel, customClient, getDraftSpy } = await setup();
Expand All @@ -186,6 +191,11 @@ describe('MessageInput in Thread', () => {
customClient,
});
expect(getDraftSpy).not.toHaveBeenCalled();
await act(() => {
customClient.setMessageComposerSetupFunction(({ composer }) => {
composer.updateConfig({ drafts: { enabled: false } });
});
});
});
it('prevents querying if not rendered inside a thread', async () => {
const { customChannel, customClient, getDraftSpy } = await setup();
Expand All @@ -200,6 +210,11 @@ describe('MessageInput in Thread', () => {
customClient,
});
expect(getDraftSpy).not.toHaveBeenCalled();
await act(() => {
customClient.setMessageComposerSetupFunction(({ composer }) => {
composer.updateConfig({ drafts: { enabled: false } });
});
});
});
it('prevents querying if drafts are disabled (default)', async () => {
const { customChannel, customClient, getDraftSpy } = await setup();
Expand Down
3 changes: 2 additions & 1 deletion src/components/Poll/PollCreationDialog/OptionFieldSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
});
}}
onKeyUp={(event) => {
if (event.key === 'Enter') {
const isFocusedLastOptionField = i === options.length - 1;

Check warning on line 68 in src/components/Poll/PollCreationDialog/OptionFieldSet.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Poll/PollCreationDialog/OptionFieldSet.tsx#L68

Added line #L68 was not covered by tests
if (event.key === 'Enter' && !isFocusedLastOptionField) {
const nextInputId = options[i + 1].id;
document.getElementById(nextInputId)?.focus();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const PollCreationDialogControls = ({
messageComposer.pollComposer.initState();
close();
}}
type='button'
>
{t('Cancel')}
</button>
Expand Down