mirror of https://github.com/vector-im/riot-web
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 { addTextToComposer } from "../../../test-utils/composer";
|
||||
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", () => {
|
||||
stubClient();
|
||||
|
@ -346,6 +355,14 @@ describe("MessageComposer", () => {
|
|||
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(
|
||||
|
|
Loading…
Reference in New Issue