Add test in MessageComposer
parent
ec1140e274
commit
6c7158197c
|
@ -39,6 +39,15 @@ import { SendMessageComposer } from "../../../../src/components/views/rooms/Send
|
||||||
import { E2EStatus } from "../../../../src/utils/ShieldUtils";
|
import { E2EStatus } from "../../../../src/utils/ShieldUtils";
|
||||||
import { addTextToComposer } from "../../../test-utils/composer";
|
import { addTextToComposer } from "../../../test-utils/composer";
|
||||||
import UIStore, { UI_EVENTS } from "../../../../src/stores/UIStore";
|
import UIStore, { UI_EVENTS } from "../../../../src/stores/UIStore";
|
||||||
|
import { WysiwygComposer } from "../../../../src/components/views/rooms/wysiwyg_composer/WysiwygComposer";
|
||||||
|
|
||||||
|
// The wysiwyg fetch wasm bytes and a specific workaround is needed to make it works in a node (jest) environnement
|
||||||
|
// See https://github.com/matrix-org/matrix-wysiwyg/blob/main/platforms/web/test.setup.ts
|
||||||
|
jest.mock("@matrix-org/matrix-wysiwyg", () => ({
|
||||||
|
useWysiwyg: ({ onChange }) => {
|
||||||
|
return { ref: { current: null }, isWysiwygReady: true, wysiwyg: { clear: () => void 0 } };
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
describe("MessageComposer", () => {
|
describe("MessageComposer", () => {
|
||||||
stubClient();
|
stubClient();
|
||||||
|
@ -346,6 +355,14 @@ describe("MessageComposer", () => {
|
||||||
expect(wrapper.find(MessageComposerButtons).props().showStickersButton).toBe(false);
|
expect(wrapper.find(MessageComposerButtons).props().showStickersButton).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should render WysiwygComposer', () => {
|
||||||
|
const room = mkStubRoom("!roomId:server", "Room 1", cli);
|
||||||
|
|
||||||
|
SettingsStore.setValue("feature_wysiwyg_composer", null, SettingLevel.DEVICE, true);
|
||||||
|
const wrapper = wrapAndRender({ room });
|
||||||
|
expect(wrapper.find(WysiwygComposer)).toBeTruthy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function wrapAndRender(
|
function wrapAndRender(
|
||||||
|
|
Loading…
Reference in New Issue