You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-09 08:42:50 +03:00
Review clean
This commit is contained in:
@@ -24,7 +24,7 @@ import RoomContext from "../../../../../src/contexts/RoomContext";
|
|||||||
import defaultDispatcher from "../../../../../src/dispatcher/dispatcher";
|
import defaultDispatcher from "../../../../../src/dispatcher/dispatcher";
|
||||||
import { Action } from "../../../../../src/dispatcher/actions";
|
import { Action } from "../../../../../src/dispatcher/actions";
|
||||||
import { IRoomState } from "../../../../../src/components/structures/RoomView";
|
import { IRoomState } from "../../../../../src/components/structures/RoomView";
|
||||||
import { createTestClient, getRoomContext, mkEvent, mkStubRoom } from "../../../../test-utils";
|
import { createTestClient, flushPromises, getRoomContext, mkEvent, mkStubRoom } from "../../../../test-utils";
|
||||||
import { SendWysiwygComposer } from "../../../../../src/components/views/rooms/wysiwyg_composer";
|
import { SendWysiwygComposer } from "../../../../../src/components/views/rooms/wysiwyg_composer";
|
||||||
import * as useComposerFunctions
|
import * as useComposerFunctions
|
||||||
from "../../../../../src/components/views/rooms/wysiwyg_composer/hooks/useComposerFunctions";
|
from "../../../../../src/components/views/rooms/wysiwyg_composer/hooks/useComposerFunctions";
|
||||||
@@ -110,9 +110,6 @@ describe('SendWysiwygComposer', () => {
|
|||||||
it('Should focus when receiving an Action.FocusSendMessageComposer action', async () => {
|
it('Should focus when receiving an Action.FocusSendMessageComposer action', async () => {
|
||||||
// Given we don't have focus
|
// Given we don't have focus
|
||||||
customRender(jest.fn(), jest.fn(), false, isRichTextEnabled);
|
customRender(jest.fn(), jest.fn(), false, isRichTextEnabled);
|
||||||
document.head.focus();
|
|
||||||
// screen.getByLabelText('Bold').focus();
|
|
||||||
// expect(screen.getByRole('textbox')).not.toHaveFocus();
|
|
||||||
|
|
||||||
// When we send the right action
|
// When we send the right action
|
||||||
defaultDispatcher.dispatch({
|
defaultDispatcher.dispatch({
|
||||||
@@ -129,8 +126,6 @@ describe('SendWysiwygComposer', () => {
|
|||||||
const mock = jest.spyOn(useComposerFunctions, 'useComposerFunctions');
|
const mock = jest.spyOn(useComposerFunctions, 'useComposerFunctions');
|
||||||
mock.mockReturnValue({ clear: mockClear });
|
mock.mockReturnValue({ clear: mockClear });
|
||||||
customRender(jest.fn(), jest.fn(), false, isRichTextEnabled);
|
customRender(jest.fn(), jest.fn(), false, isRichTextEnabled);
|
||||||
// screen.getByLabelText('Bold').focus();
|
|
||||||
// expect(screen.getByRole('textbox')).not.toHaveFocus();
|
|
||||||
|
|
||||||
// When we send the right action
|
// When we send the right action
|
||||||
defaultDispatcher.dispatch({
|
defaultDispatcher.dispatch({
|
||||||
@@ -148,8 +143,6 @@ describe('SendWysiwygComposer', () => {
|
|||||||
it('Should focus when receiving a reply_to_event action', async () => {
|
it('Should focus when receiving a reply_to_event action', async () => {
|
||||||
// Given we don't have focus
|
// Given we don't have focus
|
||||||
customRender(jest.fn(), jest.fn(), false, isRichTextEnabled);
|
customRender(jest.fn(), jest.fn(), false, isRichTextEnabled);
|
||||||
// screen.getByLabelText('Bold').focus();
|
|
||||||
// expect(screen.getByRole('textbox')).not.toHaveFocus();
|
|
||||||
|
|
||||||
// When we send the right action
|
// When we send the right action
|
||||||
defaultDispatcher.dispatch({
|
defaultDispatcher.dispatch({
|
||||||
@@ -178,7 +171,7 @@ describe('SendWysiwygComposer', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Wait for event dispatch to happen
|
// Wait for event dispatch to happen
|
||||||
await new Promise((r) => setTimeout(r, 200));
|
await flushPromises();
|
||||||
|
|
||||||
// Then we don't get it because we are disabled
|
// Then we don't get it because we are disabled
|
||||||
expect(screen.getByRole('textbox')).not.toHaveFocus();
|
expect(screen.getByRole('textbox')).not.toHaveFocus();
|
||||||
|
Reference in New Issue
Block a user