Step 3.1: Stop using getComponent
in tests
This commit is contained in:
parent
15b84bd9a6
commit
26dc2ba45e
23 changed files with 27 additions and 63 deletions
|
@ -24,7 +24,6 @@ import { mount } from "enzyme";
|
||||||
import * as TestUtils from "react-dom/test-utils";
|
import * as TestUtils from "react-dom/test-utils";
|
||||||
|
|
||||||
import { MatrixClientPeg } from '../../../src/MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../src/MatrixClientPeg';
|
||||||
import sdk from '../../skinned-sdk';
|
|
||||||
import MessagePanel, { shouldFormContinuation } from "../../../src/components/structures/MessagePanel";
|
import MessagePanel, { shouldFormContinuation } from "../../../src/components/structures/MessagePanel";
|
||||||
import SettingsStore from "../../../src/settings/SettingsStore";
|
import SettingsStore from "../../../src/settings/SettingsStore";
|
||||||
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
|
||||||
|
@ -32,6 +31,9 @@ import RoomContext from "../../../src/contexts/RoomContext";
|
||||||
import DMRoomMap from "../../../src/utils/DMRoomMap";
|
import DMRoomMap from "../../../src/utils/DMRoomMap";
|
||||||
import { UnwrappedEventTile } from "../../../src/components/views/rooms/EventTile";
|
import { UnwrappedEventTile } from "../../../src/components/views/rooms/EventTile";
|
||||||
import * as TestUtilsMatrix from "../../test-utils";
|
import * as TestUtilsMatrix from "../../test-utils";
|
||||||
|
import EventListSummary from "../../../src/components/views/elements/EventListSummary";
|
||||||
|
import GenericEventListSummary from "../../../src/components/views/elements/GenericEventListSummary";
|
||||||
|
import DateSeparator from "../../../src/components/views/messages/DateSeparator";
|
||||||
|
|
||||||
let client;
|
let client;
|
||||||
const room = new Matrix.Room("!roomId:server_name");
|
const room = new Matrix.Room("!roomId:server_name");
|
||||||
|
@ -298,7 +300,7 @@ describe('MessagePanel', function() {
|
||||||
expect(tiles.length).toEqual(2);
|
expect(tiles.length).toEqual(2);
|
||||||
|
|
||||||
const summaryTiles = TestUtils.scryRenderedComponentsWithType(
|
const summaryTiles = TestUtils.scryRenderedComponentsWithType(
|
||||||
res, sdk.getComponent('elements.EventListSummary'),
|
res, EventListSummary,
|
||||||
);
|
);
|
||||||
expect(summaryTiles.length).toEqual(1);
|
expect(summaryTiles.length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
@ -443,7 +445,7 @@ describe('MessagePanel', function() {
|
||||||
expect(tiles.at(0).props().mxEvent.getType()).toEqual("m.room.create");
|
expect(tiles.at(0).props().mxEvent.getType()).toEqual("m.room.create");
|
||||||
expect(tiles.at(1).props().mxEvent.getType()).toEqual("m.room.encryption");
|
expect(tiles.at(1).props().mxEvent.getType()).toEqual("m.room.encryption");
|
||||||
|
|
||||||
const summaryTiles = res.find(sdk.getComponent('views.elements.GenericEventListSummary'));
|
const summaryTiles = res.find(GenericEventListSummary);
|
||||||
const summaryTile = summaryTiles.at(0);
|
const summaryTile = summaryTiles.at(0);
|
||||||
|
|
||||||
const summaryEventTiles = summaryTile.find(UnwrappedEventTile);
|
const summaryEventTiles = summaryTile.find(UnwrappedEventTile);
|
||||||
|
@ -483,7 +485,7 @@ describe('MessagePanel', function() {
|
||||||
events={events}
|
events={events}
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
const Dates = res.find(sdk.getComponent('messages.DateSeparator'));
|
const Dates = res.find(DateSeparator);
|
||||||
|
|
||||||
expect(Dates.length).toEqual(1);
|
expect(Dates.length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,9 +20,10 @@ import ReactTestUtils from 'react-dom/test-utils';
|
||||||
import { mocked } from 'jest-mock';
|
import { mocked } from 'jest-mock';
|
||||||
import { createClient, MatrixClient } from "matrix-js-sdk/src/matrix";
|
import { createClient, MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||||
|
|
||||||
import sdk from '../../../skinned-sdk';
|
|
||||||
import SdkConfig from '../../../../src/SdkConfig';
|
import SdkConfig from '../../../../src/SdkConfig';
|
||||||
import { mkServerConfig } from "../../../test-utils";
|
import { mkServerConfig } from "../../../test-utils";
|
||||||
|
import Login from "../../../../src/components/structures/auth/Login";
|
||||||
|
import PasswordLogin from "../../../../src/components/views/auth/PasswordLogin";
|
||||||
|
|
||||||
jest.mock("matrix-js-sdk/src/matrix");
|
jest.mock("matrix-js-sdk/src/matrix");
|
||||||
|
|
||||||
|
@ -30,10 +31,6 @@ const flushPromises = async () => await new Promise(process.nextTick);
|
||||||
|
|
||||||
jest.useRealTimers();
|
jest.useRealTimers();
|
||||||
|
|
||||||
const Login = sdk.getComponent(
|
|
||||||
'structures.auth.Login',
|
|
||||||
);
|
|
||||||
|
|
||||||
describe('Login', function() {
|
describe('Login', function() {
|
||||||
let parentDiv;
|
let parentDiv;
|
||||||
const mockClient = mocked({
|
const mockClient = mocked({
|
||||||
|
@ -80,7 +77,7 @@ describe('Login', function() {
|
||||||
|
|
||||||
const form = ReactTestUtils.findRenderedComponentWithType(
|
const form = ReactTestUtils.findRenderedComponentWithType(
|
||||||
root,
|
root,
|
||||||
sdk.getComponent('auth.PasswordLogin'),
|
PasswordLogin,
|
||||||
);
|
);
|
||||||
expect(form).toBeTruthy();
|
expect(form).toBeTruthy();
|
||||||
|
|
||||||
|
@ -94,7 +91,7 @@ describe('Login', function() {
|
||||||
|
|
||||||
const form = ReactTestUtils.findRenderedComponentWithType(
|
const form = ReactTestUtils.findRenderedComponentWithType(
|
||||||
root,
|
root,
|
||||||
sdk.getComponent('auth.PasswordLogin'),
|
PasswordLogin,
|
||||||
);
|
);
|
||||||
expect(form).toBeTruthy();
|
expect(form).toBeTruthy();
|
||||||
|
|
||||||
|
@ -118,7 +115,7 @@ describe('Login', function() {
|
||||||
const root = render();
|
const root = render();
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
const form = ReactTestUtils.findRenderedComponentWithType(root, sdk.getComponent('auth.PasswordLogin'));
|
const form = ReactTestUtils.findRenderedComponentWithType(root, PasswordLogin);
|
||||||
expect(form).toBeTruthy();
|
expect(form).toBeTruthy();
|
||||||
|
|
||||||
const ssoButton = ReactTestUtils.findRenderedDOMComponentWithClass(root, "mx_SSOButton");
|
const ssoButton = ReactTestUtils.findRenderedDOMComponentWithClass(root, "mx_SSOButton");
|
||||||
|
|
|
@ -19,17 +19,14 @@ import ReactDOM from 'react-dom';
|
||||||
import ReactTestUtils from 'react-dom/test-utils';
|
import ReactTestUtils from 'react-dom/test-utils';
|
||||||
import { createClient } from 'matrix-js-sdk/src/matrix';
|
import { createClient } from 'matrix-js-sdk/src/matrix';
|
||||||
|
|
||||||
import sdk from '../../../skinned-sdk';
|
|
||||||
import SdkConfig, { DEFAULTS } from '../../../../src/SdkConfig';
|
import SdkConfig, { DEFAULTS } from '../../../../src/SdkConfig';
|
||||||
import { createTestClient, mkServerConfig } from "../../../test-utils";
|
import { createTestClient, mkServerConfig } from "../../../test-utils";
|
||||||
|
import Registration from "../../../../src/components/structures/auth/Registration";
|
||||||
|
import RegistrationForm from "../../../../src/components/views/auth/RegistrationForm";
|
||||||
|
|
||||||
jest.mock('matrix-js-sdk/src/matrix');
|
jest.mock('matrix-js-sdk/src/matrix');
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
|
|
||||||
const Registration = sdk.getComponent(
|
|
||||||
'structures.auth.Registration',
|
|
||||||
);
|
|
||||||
|
|
||||||
describe('Registration', function() {
|
describe('Registration', function() {
|
||||||
let parentDiv;
|
let parentDiv;
|
||||||
|
|
||||||
|
@ -79,7 +76,7 @@ describe('Registration', function() {
|
||||||
|
|
||||||
const form = ReactTestUtils.findRenderedComponentWithType(
|
const form = ReactTestUtils.findRenderedComponentWithType(
|
||||||
root,
|
root,
|
||||||
sdk.getComponent('auth.RegistrationForm'),
|
RegistrationForm,
|
||||||
);
|
);
|
||||||
expect(form).toBeTruthy();
|
expect(form).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,6 @@ import React from 'react';
|
||||||
import { mocked } from 'jest-mock';
|
import { mocked } from 'jest-mock';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import '../../../skinned-sdk';
|
|
||||||
import LeftPanelLiveShareWarning from '../../../../src/components/views/beacon/LeftPanelLiveShareWarning';
|
import LeftPanelLiveShareWarning from '../../../../src/components/views/beacon/LeftPanelLiveShareWarning';
|
||||||
import { OwnBeaconStore, OwnBeaconStoreEvent } from '../../../../src/stores/OwnBeaconStore';
|
import { OwnBeaconStore, OwnBeaconStoreEvent } from '../../../../src/stores/OwnBeaconStore';
|
||||||
import { flushPromises } from '../../../test-utils';
|
import { flushPromises } from '../../../test-utils';
|
||||||
|
|
|
@ -20,7 +20,6 @@ import { mount } from 'enzyme';
|
||||||
import { Room, Beacon, BeaconEvent } from 'matrix-js-sdk/src/matrix';
|
import { Room, Beacon, BeaconEvent } from 'matrix-js-sdk/src/matrix';
|
||||||
import { logger } from 'matrix-js-sdk/src/logger';
|
import { logger } from 'matrix-js-sdk/src/logger';
|
||||||
|
|
||||||
import '../../../skinned-sdk';
|
|
||||||
import RoomLiveShareWarning from '../../../../src/components/views/beacon/RoomLiveShareWarning';
|
import RoomLiveShareWarning from '../../../../src/components/views/beacon/RoomLiveShareWarning';
|
||||||
import { OwnBeaconStore, OwnBeaconStoreEvent } from '../../../../src/stores/OwnBeaconStore';
|
import { OwnBeaconStore, OwnBeaconStoreEvent } from '../../../../src/stores/OwnBeaconStore';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import '../../../skinned-sdk';
|
|
||||||
import StyledLiveBeaconIcon from '../../../../src/components/views/beacon/StyledLiveBeaconIcon';
|
import StyledLiveBeaconIcon from '../../../../src/components/views/beacon/StyledLiveBeaconIcon';
|
||||||
|
|
||||||
describe('<StyledLiveBeaconIcon />', () => {
|
describe('<StyledLiveBeaconIcon />', () => {
|
||||||
|
|
|
@ -18,12 +18,10 @@ import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
|
|
||||||
import sdk from '../../../skinned-sdk';
|
|
||||||
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
|
||||||
import { stubClient } from '../../../test-utils';
|
import { stubClient } from '../../../test-utils';
|
||||||
import { findById, flushPromises } from '../../../test-utils';
|
import { findById, flushPromises } from '../../../test-utils';
|
||||||
|
import AccessSecretStorageDialog from "../../../../src/components/views/dialogs/security/AccessSecretStorageDialog";
|
||||||
const AccessSecretStorageDialog = sdk.getComponent("dialogs.security.AccessSecretStorageDialog");
|
|
||||||
|
|
||||||
describe("AccessSecretStorageDialog", function() {
|
describe("AccessSecretStorageDialog", function() {
|
||||||
it("Closes the dialog if _onRecoveryKeyNext is called with a valid key", async () => {
|
it("Closes the dialog if _onRecoveryKeyNext is called with a valid key", async () => {
|
||||||
|
|
|
@ -20,13 +20,9 @@ import ReactTestUtils from 'react-dom/test-utils';
|
||||||
import MatrixReactTestUtils from 'matrix-react-test-utils';
|
import MatrixReactTestUtils from 'matrix-react-test-utils';
|
||||||
import { sleep } from "matrix-js-sdk/src/utils";
|
import { sleep } from "matrix-js-sdk/src/utils";
|
||||||
|
|
||||||
import sdk from '../../../skinned-sdk';
|
|
||||||
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
|
||||||
import * as TestUtilsMatrix from '../../../test-utils';
|
import * as TestUtilsMatrix from '../../../test-utils';
|
||||||
|
import InteractiveAuthDialog from "../../../../src/components/views/dialogs/InteractiveAuthDialog";
|
||||||
const InteractiveAuthDialog = sdk.getComponent(
|
|
||||||
'views.dialogs.InteractiveAuthDialog',
|
|
||||||
);
|
|
||||||
|
|
||||||
describe('InteractiveAuthDialog', function() {
|
describe('InteractiveAuthDialog', function() {
|
||||||
let parentDiv;
|
let parentDiv;
|
||||||
|
|
|
@ -2,11 +2,11 @@ import React from 'react';
|
||||||
import ReactTestUtils from 'react-dom/test-utils';
|
import ReactTestUtils from 'react-dom/test-utils';
|
||||||
import ShallowRenderer from "react-test-renderer/shallow";
|
import ShallowRenderer from "react-test-renderer/shallow";
|
||||||
|
|
||||||
import sdk from '../../../skinned-sdk';
|
|
||||||
import * as testUtils from '../../../test-utils';
|
import * as testUtils from '../../../test-utils';
|
||||||
|
import _EventListSummary from "../../../../src/components/views/elements/EventListSummary";
|
||||||
|
|
||||||
// Give ELS a matrixClient in its child context
|
// Give ELS a matrixClient in its child context
|
||||||
const EventListSummary = testUtils.wrapInMatrixClientContext(sdk.getComponent('views.elements.EventListSummary'));
|
const EventListSummary = testUtils.wrapInMatrixClientContext(_EventListSummary);
|
||||||
|
|
||||||
describe('EventListSummary', function() {
|
describe('EventListSummary', function() {
|
||||||
// Generate dummy event tiles for use in simulating an expanded MELS
|
// Generate dummy event tiles for use in simulating an expanded MELS
|
||||||
|
|
|
@ -18,7 +18,6 @@ import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
|
|
||||||
import '../../../skinned-sdk';
|
|
||||||
import LiveDurationDropdown, { DEFAULT_DURATION_MS }
|
import LiveDurationDropdown, { DEFAULT_DURATION_MS }
|
||||||
from '../../../../src/components/views/location/LiveDurationDropdown';
|
from '../../../../src/components/views/location/LiveDurationDropdown';
|
||||||
import { findById, mockPlatformPeg } from '../../../test-utils';
|
import { findById, mockPlatformPeg } from '../../../test-utils';
|
||||||
|
|
|
@ -14,11 +14,8 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import sdk from "../../../skinned-sdk";
|
|
||||||
import { textForLocation } from "../../../../src/components/views/location/shareLocation";
|
import { textForLocation } from "../../../../src/components/views/location/shareLocation";
|
||||||
|
|
||||||
sdk.getComponent("LocationPicker");
|
|
||||||
|
|
||||||
describe("LocationButton", () => {
|
describe("LocationButton", () => {
|
||||||
describe("textForLocation", () => {
|
describe("textForLocation", () => {
|
||||||
it("with no description, simply dumps URI and date", () => {
|
it("with no description, simply dumps URI and date", () => {
|
||||||
|
|
|
@ -17,7 +17,6 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import '../../../skinned-sdk';
|
|
||||||
import { MapError } from '../../../../src/components/views/location/MapError';
|
import { MapError } from '../../../../src/components/views/location/MapError';
|
||||||
import { LocationShareError } from '../../../../src/utils/location';
|
import { LocationShareError } from '../../../../src/utils/location';
|
||||||
|
|
||||||
|
|
|
@ -18,17 +18,15 @@ import React from "react";
|
||||||
import { mount } from "enzyme";
|
import { mount } from "enzyme";
|
||||||
import { mocked } from "jest-mock";
|
import { mocked } from "jest-mock";
|
||||||
|
|
||||||
import sdk from "../../../skinned-sdk";
|
|
||||||
import { formatFullDateNoTime } from "../../../../src/DateUtils";
|
import { formatFullDateNoTime } from "../../../../src/DateUtils";
|
||||||
import SettingsStore from "../../../../src/settings/SettingsStore";
|
import SettingsStore from "../../../../src/settings/SettingsStore";
|
||||||
import { UIFeature } from "../../../../src/settings/UIFeature";
|
import { UIFeature } from "../../../../src/settings/UIFeature";
|
||||||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||||
import { getMockClientWithEventEmitter } from "../../../test-utils";
|
import { getMockClientWithEventEmitter } from "../../../test-utils";
|
||||||
|
import DateSeparator from "../../../../src/components/views/messages/DateSeparator";
|
||||||
|
|
||||||
jest.mock("../../../../src/settings/SettingsStore");
|
jest.mock("../../../../src/settings/SettingsStore");
|
||||||
|
|
||||||
const DateSeparator = sdk.getComponent("views.messages.DateSeparator");
|
|
||||||
|
|
||||||
describe("DateSeparator", () => {
|
describe("DateSeparator", () => {
|
||||||
const HOUR_MS = 3600000;
|
const HOUR_MS = 3600000;
|
||||||
const DAY_MS = HOUR_MS * 24;
|
const DAY_MS = HOUR_MS * 24;
|
||||||
|
|
|
@ -29,7 +29,6 @@ import { TEXT_NODE_TYPE } from "matrix-js-sdk/src/@types/extensible_events";
|
||||||
import maplibregl from 'maplibre-gl';
|
import maplibregl from 'maplibre-gl';
|
||||||
import { logger } from 'matrix-js-sdk/src/logger';
|
import { logger } from 'matrix-js-sdk/src/logger';
|
||||||
|
|
||||||
import sdk from "../../../skinned-sdk";
|
|
||||||
import MLocationBody, {
|
import MLocationBody, {
|
||||||
isSelfLocation,
|
isSelfLocation,
|
||||||
} from "../../../../src/components/views/messages/MLocationBody";
|
} from "../../../../src/components/views/messages/MLocationBody";
|
||||||
|
@ -44,8 +43,6 @@ jest.mock("../../../../src/utils/WellKnownUtils", () => ({
|
||||||
getTileServerWellKnown: jest.fn(),
|
getTileServerWellKnown: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
sdk.getComponent("views.messages.MLocationBody");
|
|
||||||
|
|
||||||
describe("MLocationBody", () => {
|
describe("MLocationBody", () => {
|
||||||
describe("isSelfLocation", () => {
|
describe("isSelfLocation", () => {
|
||||||
it("Returns true for a full m.asset event", () => {
|
it("Returns true for a full m.asset event", () => {
|
||||||
|
|
|
@ -31,7 +31,6 @@ import {
|
||||||
} from "matrix-events-sdk";
|
} from "matrix-events-sdk";
|
||||||
import { MockedObject } from "jest-mock";
|
import { MockedObject } from "jest-mock";
|
||||||
|
|
||||||
import sdk from "../../../skinned-sdk";
|
|
||||||
import {
|
import {
|
||||||
UserVote,
|
UserVote,
|
||||||
allVotes,
|
allVotes,
|
||||||
|
@ -43,11 +42,10 @@ import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||||
import { IBodyProps } from "../../../../src/components/views/messages/IBodyProps";
|
import { IBodyProps } from "../../../../src/components/views/messages/IBodyProps";
|
||||||
import { getMockClientWithEventEmitter } from "../../../test-utils";
|
import { getMockClientWithEventEmitter } from "../../../test-utils";
|
||||||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||||
|
import MPollBody from "../../../../src/components/views/messages/MPollBody";
|
||||||
|
|
||||||
const CHECKED = "mx_MPollBody_option_checked";
|
const CHECKED = "mx_MPollBody_option_checked";
|
||||||
|
|
||||||
const MPollBody = sdk.getComponent("views.messages.MPollBody");
|
|
||||||
|
|
||||||
const mockClient = getMockClientWithEventEmitter({
|
const mockClient = getMockClientWithEventEmitter({
|
||||||
getUserId: jest.fn().mockReturnValue("@me:example.com"),
|
getUserId: jest.fn().mockReturnValue("@me:example.com"),
|
||||||
sendEvent: jest.fn().mockReturnValue(Promise.resolve({ "event_id": "fake_send_id" })),
|
sendEvent: jest.fn().mockReturnValue(Promise.resolve({ "event_id": "fake_send_id" })),
|
||||||
|
|
|
@ -17,14 +17,13 @@ limitations under the License.
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { mount } from "enzyme";
|
import { mount } from "enzyme";
|
||||||
|
|
||||||
import sdk from "../../../skinned-sdk";
|
|
||||||
import { mkEvent, mkStubRoom } from "../../../test-utils";
|
import { mkEvent, mkStubRoom } from "../../../test-utils";
|
||||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||||
import * as languageHandler from "../../../../src/languageHandler";
|
import * as languageHandler from "../../../../src/languageHandler";
|
||||||
import * as TestUtils from "../../../test-utils";
|
import * as TestUtils from "../../../test-utils";
|
||||||
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
||||||
|
import _TextualBody from "../../../../src/components/views/messages/TextualBody";
|
||||||
|
|
||||||
const _TextualBody = sdk.getComponent("views.messages.TextualBody");
|
|
||||||
const TextualBody = TestUtils.wrapInMatrixClientContext(_TextualBody);
|
const TextualBody = TestUtils.wrapInMatrixClientContext(_TextualBody);
|
||||||
|
|
||||||
describe("<TextualBody />", () => {
|
describe("<TextualBody />", () => {
|
||||||
|
|
|
@ -31,7 +31,6 @@ import {
|
||||||
PollEndEvent,
|
PollEndEvent,
|
||||||
} from "matrix-events-sdk";
|
} from "matrix-events-sdk";
|
||||||
|
|
||||||
import "../../../skinned-sdk";
|
|
||||||
import {
|
import {
|
||||||
stubClient,
|
stubClient,
|
||||||
mkStubRoom,
|
mkStubRoom,
|
||||||
|
|
|
@ -19,7 +19,6 @@ import { mount, ReactWrapper } from "enzyme";
|
||||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
|
||||||
import '../../../skinned-sdk'; // Must be first for skinning to work
|
|
||||||
import { createTestClient, mkEvent, mkStubRoom, stubClient } from "../../../test-utils";
|
import { createTestClient, mkEvent, mkStubRoom, stubClient } from "../../../test-utils";
|
||||||
import MessageComposer from "../../../../src/components/views/rooms/MessageComposer";
|
import MessageComposer from "../../../../src/components/views/rooms/MessageComposer";
|
||||||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||||
|
|
|
@ -19,15 +19,13 @@ import { mount, ReactWrapper } from "enzyme";
|
||||||
import { Room } from "matrix-js-sdk/src/models/room";
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||||
|
|
||||||
import sdk from "../../../skinned-sdk";
|
|
||||||
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
|
||||||
import { Layout } from "../../../../src/settings/enums/Layout";
|
import { Layout } from "../../../../src/settings/enums/Layout";
|
||||||
import RoomContext, { TimelineRenderingType } from "../../../../src/contexts/RoomContext";
|
import RoomContext, { TimelineRenderingType } from "../../../../src/contexts/RoomContext";
|
||||||
import { createTestClient } from "../../../test-utils";
|
import { createTestClient } from "../../../test-utils";
|
||||||
import { IRoomState } from "../../../../src/components/structures/RoomView";
|
import { IRoomState } from "../../../../src/components/structures/RoomView";
|
||||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||||
|
import MessageComposerButtons from "../../../../src/components/views/rooms/MessageComposerButtons";
|
||||||
const MessageComposerButtons = sdk.getComponent("views.rooms.MessageComposerButtons");
|
|
||||||
|
|
||||||
describe("MessageComposerButtons", () => {
|
describe("MessageComposerButtons", () => {
|
||||||
it("Renders emoji and upload buttons in wide mode", () => {
|
it("Renders emoji and upload buttons in wide mode", () => {
|
||||||
|
|
|
@ -5,12 +5,14 @@ import { MatrixClient, Room, RoomMember } from 'matrix-js-sdk/src/matrix';
|
||||||
|
|
||||||
import * as TestUtils from '../../../test-utils';
|
import * as TestUtils from '../../../test-utils';
|
||||||
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../../src/MatrixClientPeg';
|
||||||
import sdk from '../../../skinned-sdk';
|
|
||||||
import dis from '../../../../src/dispatcher/dispatcher';
|
import dis from '../../../../src/dispatcher/dispatcher';
|
||||||
import DMRoomMap from '../../../../src/utils/DMRoomMap';
|
import DMRoomMap from '../../../../src/utils/DMRoomMap';
|
||||||
import { DefaultTagID } from "../../../../src/stores/room-list/models";
|
import { DefaultTagID } from "../../../../src/stores/room-list/models";
|
||||||
import RoomListStore, { RoomListStoreClass } from "../../../../src/stores/room-list/RoomListStore";
|
import RoomListStore, { RoomListStoreClass } from "../../../../src/stores/room-list/RoomListStore";
|
||||||
import RoomListLayoutStore from "../../../../src/stores/room-list/RoomListLayoutStore";
|
import RoomListLayoutStore from "../../../../src/stores/room-list/RoomListLayoutStore";
|
||||||
|
import RoomList from "../../../../src/components/views/rooms/RoomList";
|
||||||
|
import RoomSublist from "../../../../src/components/views/rooms/RoomSublist";
|
||||||
|
import RoomTile from "../../../../src/components/views/rooms/RoomTile";
|
||||||
|
|
||||||
function generateRoomId() {
|
function generateRoomId() {
|
||||||
return '!' + Math.random().toString().slice(2, 10) + ':domain';
|
return '!' + Math.random().toString().slice(2, 10) + ':domain';
|
||||||
|
@ -54,7 +56,6 @@ describe('RoomList', () => {
|
||||||
parentDiv = document.createElement('div');
|
parentDiv = document.createElement('div');
|
||||||
document.body.appendChild(parentDiv);
|
document.body.appendChild(parentDiv);
|
||||||
|
|
||||||
const RoomList = sdk.getComponent('views.rooms.RoomList');
|
|
||||||
const WrappedRoomList = TestUtils.wrapInMatrixClientContext(RoomList);
|
const WrappedRoomList = TestUtils.wrapInMatrixClientContext(RoomList);
|
||||||
root = ReactDOM.render(
|
root = ReactDOM.render(
|
||||||
<WrappedRoomList searchFilter="" onResize={() => {}} />,
|
<WrappedRoomList searchFilter="" onResize={() => {}} />,
|
||||||
|
@ -119,10 +120,7 @@ describe('RoomList', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function expectRoomInSubList(room, subListTest) {
|
function expectRoomInSubList(room, subListTest) {
|
||||||
const RoomSubList = sdk.getComponent('views.rooms.RoomSublist');
|
const subLists = ReactTestUtils.scryRenderedComponentsWithType(root, RoomSublist);
|
||||||
const RoomTile = sdk.getComponent('views.rooms.RoomTile');
|
|
||||||
|
|
||||||
const subLists = ReactTestUtils.scryRenderedComponentsWithType(root, RoomSubList);
|
|
||||||
const containingSubList = subLists.find(subListTest);
|
const containingSubList = subLists.find(subListTest);
|
||||||
|
|
||||||
let expectedRoomTile;
|
let expectedRoomTile;
|
||||||
|
|
|
@ -21,7 +21,6 @@ import { mocked } from "jest-mock";
|
||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||||
|
|
||||||
import "../../../skinned-sdk";
|
|
||||||
import {
|
import {
|
||||||
stubClient,
|
stubClient,
|
||||||
mockStateEventImplementation,
|
mockStateEventImplementation,
|
||||||
|
|
|
@ -20,12 +20,10 @@ import { SearchResult } from "matrix-js-sdk/src/models/search-result";
|
||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||||
|
|
||||||
import sdk from "../../../skinned-sdk";
|
|
||||||
import { createTestClient } from "../../../test-utils";
|
import { createTestClient } from "../../../test-utils";
|
||||||
import EventTile from "../../../../src/components/views/rooms/EventTile";
|
import EventTile from "../../../../src/components/views/rooms/EventTile";
|
||||||
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
|
||||||
|
import SearchResultTile from "../../../../src/components/views/rooms/SearchResultTile";
|
||||||
const SearchResultTile = sdk.getComponent("views.rooms.SearchResultTile");
|
|
||||||
|
|
||||||
describe("SearchResultTile", () => {
|
describe("SearchResultTile", () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
|
|
|
@ -19,7 +19,6 @@ import { mount } from "enzyme";
|
||||||
import { act } from "react-dom/test-utils";
|
import { act } from "react-dom/test-utils";
|
||||||
import { mocked } from "jest-mock";
|
import { mocked } from "jest-mock";
|
||||||
|
|
||||||
import "../../../skinned-sdk";
|
|
||||||
import { stubClient, mkStubRoom, wrapInMatrixClientContext } from "../../../test-utils";
|
import { stubClient, mkStubRoom, wrapInMatrixClientContext } from "../../../test-utils";
|
||||||
import { stubVoiceChannelStore } from "../../../test-utils/voice";
|
import { stubVoiceChannelStore } from "../../../test-utils/voice";
|
||||||
import _VoiceChannelRadio from "../../../../src/components/views/voip/VoiceChannelRadio";
|
import _VoiceChannelRadio from "../../../../src/components/views/voip/VoiceChannelRadio";
|
||||||
|
|
Loading…
Reference in a new issue