You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Merge remote-tracking branch 'origin/t3chguy/jest' into travis/sourcemaps
This commit is contained in:
@ -1,9 +1,7 @@
|
||||
import expect from 'expect';
|
||||
import React from 'react';
|
||||
import ReactTestUtils from 'react-dom/test-utils';
|
||||
import ShallowRenderer from "react-test-renderer/shallow";
|
||||
import sdk from 'matrix-react-sdk';
|
||||
import * as languageHandler from '../../../../src/languageHandler';
|
||||
import sdk from '../../../skinned-sdk';
|
||||
import * as testUtils from '../../../test-utils';
|
||||
|
||||
// Give MELS a matrixClient in its child context
|
||||
@ -12,8 +10,6 @@ const MemberEventListSummary = testUtils.wrapInMatrixClientContext(
|
||||
);
|
||||
|
||||
describe('MemberEventListSummary', function() {
|
||||
let sandbox;
|
||||
|
||||
// Generate dummy event tiles for use in simulating an expanded MELS
|
||||
const generateTiles = (events) => {
|
||||
return events.map((e) => {
|
||||
@ -87,18 +83,8 @@ describe('MemberEventListSummary', function() {
|
||||
return eventsForUsers;
|
||||
};
|
||||
|
||||
beforeEach(function(done) {
|
||||
testUtils.beforeEach(this);
|
||||
sandbox = testUtils.stubClient();
|
||||
|
||||
languageHandler.setLanguage('en').then(done);
|
||||
languageHandler.setMissingEntryGenerator(function(key) {
|
||||
return key.split('|', 2)[1];
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
sandbox.restore();
|
||||
beforeEach(function() {
|
||||
testUtils.stubClient();
|
||||
});
|
||||
|
||||
it('renders expanded events if there are less than props.threshold', function() {
|
||||
@ -167,7 +153,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe("user_1 joined and left and joined");
|
||||
});
|
||||
@ -203,7 +189,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe("user_1 joined and left 7 times");
|
||||
});
|
||||
@ -251,7 +237,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 was unbanned, joined and left 7 times and was invited",
|
||||
@ -304,7 +290,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 was unbanned, joined and left 2 times, was banned, " +
|
||||
@ -363,7 +349,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 and one other were unbanned, joined and left 2 times and were banned",
|
||||
@ -401,7 +387,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_0 and 19 others were unbanned, joined and left 2 times and were banned",
|
||||
@ -452,7 +438,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_2 was unbanned and joined and left 2 times, user_1 was unbanned, " +
|
||||
@ -526,7 +512,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 was invited, was banned, joined, rejected their invitation, left, " +
|
||||
@ -573,7 +559,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 and one other rejected their invitations and " +
|
||||
@ -609,7 +595,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 rejected their invitation 2 times",
|
||||
@ -637,7 +623,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1 and user_2 joined 2 times",
|
||||
@ -664,7 +650,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_1, user_2 and one other joined",
|
||||
@ -689,7 +675,7 @@ describe('MemberEventListSummary', function() {
|
||||
const summary = ReactTestUtils.findRenderedDOMComponentWithClass(
|
||||
instance, "mx_EventListSummary_summary",
|
||||
);
|
||||
const summaryText = summary.innerText;
|
||||
const summaryText = summary.textContent;
|
||||
|
||||
expect(summaryText).toBe(
|
||||
"user_0, user_1 and 18 others joined",
|
||||
|
Reference in New Issue
Block a user