Merge remote-tracking branch 'origin/t3chguy/jest' into travis/sourcemaps
This commit is contained in:
commit
a8c8406ac4
41 changed files with 2002 additions and 1842 deletions
|
@ -17,14 +17,13 @@ limitations under the License.
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ReactTestUtils from 'react-dom/test-utils';
|
||||
import expect from 'expect';
|
||||
|
||||
import MockHttpBackend from 'matrix-mock-request';
|
||||
import {MatrixClientPeg} from '../../../src/MatrixClientPeg';
|
||||
import sdk from 'matrix-react-sdk';
|
||||
import sdk from '../../skinned-sdk';
|
||||
import Matrix from 'matrix-js-sdk';
|
||||
|
||||
import * as TestUtils from 'test-utils';
|
||||
import * as TestUtils from '../../test-utils';
|
||||
const { waitForUpdate } = TestUtils;
|
||||
|
||||
const GroupView = sdk.getComponent('structures.GroupView');
|
||||
|
@ -61,8 +60,6 @@ describe('GroupView', function() {
|
|||
};
|
||||
|
||||
beforeEach(function() {
|
||||
TestUtils.beforeEach(this);
|
||||
|
||||
httpBackend = new MockHttpBackend();
|
||||
|
||||
Matrix.request(httpBackend.requestFn);
|
||||
|
@ -194,13 +191,13 @@ describe('GroupView', function() {
|
|||
const name = ReactTestUtils.findRenderedDOMComponentWithClass(root, 'mx_GroupView_header_name');
|
||||
const nameElement = ReactDOM.findDOMNode(name);
|
||||
expect(nameElement).toBeTruthy();
|
||||
expect(nameElement.innerText).toContain('The name of a community');
|
||||
expect(nameElement.innerText).toContain(groupId);
|
||||
expect(nameElement.textContent).toContain('The name of a community');
|
||||
expect(nameElement.textContent).toContain(groupId);
|
||||
|
||||
const shortDesc = ReactTestUtils.findRenderedDOMComponentWithClass(root, 'mx_GroupView_header_shortDesc');
|
||||
const shortDescElement = ReactDOM.findDOMNode(shortDesc);
|
||||
expect(shortDescElement).toBeTruthy();
|
||||
expect(shortDescElement.innerText).toBe('This is a community');
|
||||
expect(shortDescElement.textContent).toBe('This is a community');
|
||||
});
|
||||
|
||||
httpBackend.when('GET', '/groups/' + groupIdEncoded + '/summary').respond(200, summaryResponse);
|
||||
|
@ -220,7 +217,7 @@ describe('GroupView', function() {
|
|||
const longDesc = ReactTestUtils.findRenderedDOMComponentWithClass(root, 'mx_GroupView_groupDesc');
|
||||
const longDescElement = ReactDOM.findDOMNode(longDesc);
|
||||
expect(longDescElement).toBeTruthy();
|
||||
expect(longDescElement.innerText).toBe('This is a LONG description.');
|
||||
expect(longDescElement.textContent).toBe('This is a LONG description.');
|
||||
expect(longDescElement.innerHTML).toBe('<div dir="auto">This is a <b>LONG</b> description.</div>');
|
||||
});
|
||||
|
||||
|
@ -305,7 +302,7 @@ describe('GroupView', function() {
|
|||
|
||||
it('should show a RoomDetailList after a successful /summary & /rooms (no rooms returned)', function() {
|
||||
const groupView = ReactTestUtils.findRenderedComponentWithType(root, GroupView);
|
||||
const prom = waitForUpdate(groupView, 4).then(() => {
|
||||
const prom = waitForUpdate(groupView, 5).then(() => {
|
||||
const roomDetailList = ReactTestUtils.findRenderedDOMComponentWithClass(root, 'mx_RoomDetailList');
|
||||
const roomDetailListElement = ReactDOM.findDOMNode(roomDetailList);
|
||||
expect(roomDetailListElement).toBeTruthy();
|
||||
|
@ -334,7 +331,7 @@ describe('GroupView', function() {
|
|||
const roomDetailListRoomNameElement = ReactDOM.findDOMNode(roomDetailListRoomName);
|
||||
|
||||
expect(roomDetailListRoomNameElement).toBeTruthy();
|
||||
expect(roomDetailListRoomNameElement.innerText).toEqual('Some room name');
|
||||
expect(roomDetailListRoomNameElement.textContent).toEqual('Some room name');
|
||||
});
|
||||
|
||||
httpBackend.when('GET', '/groups/' + groupIdEncoded + '/summary').respond(200, summaryResponse);
|
||||
|
@ -365,7 +362,7 @@ describe('GroupView', function() {
|
|||
const shortDesc = ReactTestUtils.findRenderedDOMComponentWithClass(root, 'mx_GroupView_header_shortDesc');
|
||||
const shortDescElement = ReactDOM.findDOMNode(shortDesc);
|
||||
expect(shortDescElement).toBeTruthy();
|
||||
expect(shortDescElement.innerText).toBe('This is a community');
|
||||
expect(shortDescElement.textContent).toBe('This is a community');
|
||||
});
|
||||
|
||||
httpBackend.when('GET', '/groups/' + groupIdEncoded + '/summary').respond(200, summaryResponse);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue