fix(composer): keep editor active while sending
This commit is contained in:
parent
85debd95a9
commit
acb7854ae7
2 changed files with 10 additions and 1 deletions
|
|
@ -247,6 +247,14 @@ function getSendButton(host: HTMLElement): HTMLButtonElement {
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTextarea(host: HTMLElement): HTMLTextAreaElement {
|
||||||
|
const textarea = host.querySelector('textarea[aria-label="Message"]');
|
||||||
|
if (!(textarea instanceof HTMLTextAreaElement)) {
|
||||||
|
throw new Error('Message textarea not found');
|
||||||
|
}
|
||||||
|
return textarea;
|
||||||
|
}
|
||||||
|
|
||||||
describe('MessageComposer pending send lifecycle', () => {
|
describe('MessageComposer pending send lifecycle', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
||||||
|
|
@ -285,6 +293,8 @@ describe('MessageComposer pending send lifecycle', () => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
expect(draftHarness.state.text).toBe('');
|
expect(draftHarness.state.text).toBe('');
|
||||||
|
expect(getTextarea(host).disabled).toBe(false);
|
||||||
|
expect(getSendButton(host).disabled).toBe(true);
|
||||||
|
|
||||||
render({ sending: false });
|
render({ sending: false });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -971,7 +971,6 @@ export const MessageComposer = ({
|
||||||
minRows={isCompactLayout ? 1 : 2}
|
minRows={isCompactLayout ? 1 : 2}
|
||||||
maxRows={6}
|
maxRows={6}
|
||||||
maxLength={MAX_TEXT_LENGTH}
|
maxLength={MAX_TEXT_LENGTH}
|
||||||
disabled={sending}
|
|
||||||
hintText={crossTeamHintText}
|
hintText={crossTeamHintText}
|
||||||
showHint={!isCompactLayout}
|
showHint={!isCompactLayout}
|
||||||
cornerActionInset={isCompactLayout ? 'compact' : 'default'}
|
cornerActionInset={isCompactLayout ? 'compact' : 'default'}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue