1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Fix missing snapshot serializer&enzyme init (#6932)

This commit is contained in:
Dariusz Niemczyk
2021-10-13 12:09:43 +02:00
committed by GitHub
parent 3417c03f41
commit bc336abf47
8 changed files with 42 additions and 25 deletions

View File

@@ -16,8 +16,7 @@ limitations under the License.
import '../skinned-sdk'; // Must be first for skinning to work
import React from "react";
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
import { configure, mount } from "enzyme";
import { mount } from "enzyme";
import {
RovingTabIndexProvider,
@@ -25,8 +24,6 @@ import {
useRovingTabIndex,
} from "../../src/accessibility/RovingTabIndex";
configure({ adapter: new Adapter() });
const Button = (props) => {
const [onFocus, isActive, ref] = useRovingTabIndex();
return <button {...props} onFocus={onFocus} tabIndex={isActive ? 0 : -1} ref={ref} />;

View File

@@ -32,15 +32,12 @@ import Matrix from 'matrix-js-sdk';
const TestUtilsMatrix = require('../../test-utils');
import FakeTimers from '@sinonjs/fake-timers';
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
import { configure, mount } from "enzyme";
import { mount } from "enzyme";
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
import RoomContext from "../../../src/contexts/RoomContext";
import DMRoomMap from "../../../src/utils/DMRoomMap";
configure({ adapter: new Adapter() });
let client;
const room = new Matrix.Room("!roomId:server_name");

View File

@@ -17,8 +17,7 @@ limitations under the License.
import "../../../skinned-sdk";
import React from "react";
import { configure, mount } from "enzyme";
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
import { mount } from "enzyme";
import { act } from "react-dom/test-utils";
import * as TestUtils from "../../../test-utils";
@@ -27,8 +26,6 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalinks";
import ForwardDialog from "../../../../src/components/views/dialogs/ForwardDialog";
configure({ adapter: new Adapter() });
describe("ForwardDialog", () => {
const sourceRoom = "!111111111111111111:example.org";
const defaultMessage = TestUtils.mkMessage({

View File

@@ -15,8 +15,7 @@ limitations under the License.
*/
import React from "react";
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
import { configure, mount } from "enzyme";
import { mount } from "enzyme";
import sdk from "../../../skinned-sdk";
import { mkEvent, mkStubRoom } from "../../../test-utils";
@@ -28,8 +27,6 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
const _TextualBody = sdk.getComponent("views.messages.TextualBody");
const TextualBody = TestUtils.wrapInMatrixClientContext(_TextualBody);
configure({ adapter: new Adapter() });
describe("<TextualBody />", () => {
afterEach(() => {
MatrixClientPeg.matrixClient = null;

View File

@@ -15,11 +15,10 @@ limitations under the License.
*/
import '../../../skinned-sdk'; // Must be first for skinning to work
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
import { configure, mount } from "enzyme";
import React from "react";
import { act } from "react-dom/test-utils";
import { sleep } from "matrix-js-sdk/src/utils";
import { mount } from 'enzyme';
import SendMessageComposer, {
createMessageContent,
@@ -40,8 +39,6 @@ import { Layout } from '../../../../src/settings/Layout';
jest.mock("../../../../src/stores/RoomViewStore");
configure({ adapter: new Adapter() });
describe('<SendMessageComposer/>', () => {
const roomContext = {
roomLoading: true,

View File

@@ -1,5 +1,7 @@
import * as languageHandler from "../src/languageHandler";
import { TextEncoder, TextDecoder } from 'util';
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
import { configure } from "enzyme";
languageHandler.setLanguage('en');
languageHandler.setMissingEntryGenerator(key => key.split("|", 2)[1]);
@@ -10,3 +12,6 @@ require('jest-fetch-mock').enableMocks();
// view https://github.com/facebook/jest/issues/9983
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;
configure({ adapter: new Adapter() });