You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-06-27 15:01:53 +03:00
Clean up some redundancy in the MessagePanel test
This commit is contained in:
@ -91,11 +91,13 @@ describe('MessagePanel', function () {
|
|||||||
|
|
||||||
var tiles = TestUtils.scryRenderedComponentsWithType(
|
var tiles = TestUtils.scryRenderedComponentsWithType(
|
||||||
mp, sdk.getComponent('rooms.EventTile'));
|
mp, sdk.getComponent('rooms.EventTile'));
|
||||||
|
var tileContainers = tiles.map(function (t) {
|
||||||
|
return ReactDOM.findDOMNode(t).parentNode;
|
||||||
|
});
|
||||||
|
|
||||||
// find the <li> which wraps the read marker
|
// find the <li> which wraps the read marker
|
||||||
var rm = TestUtils.findRenderedDOMComponentWithClass(mp, 'mx_RoomView_myReadMarker_container');
|
var rm = TestUtils.findRenderedDOMComponentWithClass(mp, 'mx_RoomView_myReadMarker_container');
|
||||||
var eventContainer = ReactDOM.findDOMNode(tiles[4]).parentNode;
|
expect(rm.previousSibling).toEqual(tileContainers[4]);
|
||||||
expect(rm.previousSibling).toEqual(eventContainer);
|
|
||||||
|
|
||||||
// now move the RM
|
// now move the RM
|
||||||
mp = ReactDOM.render(
|
mp = ReactDOM.render(
|
||||||
@ -108,18 +110,11 @@ describe('MessagePanel', function () {
|
|||||||
expect(found.length).toEqual(2);
|
expect(found.length).toEqual(2);
|
||||||
|
|
||||||
// the first should be the ghost
|
// the first should be the ghost
|
||||||
var ghost = found[0];
|
expect(found[0].previousSibling).toEqual(tileContainers[4]);
|
||||||
eventContainer = ReactDOM.findDOMNode(tiles[4]).parentNode;
|
var hr = found[0].children[0];
|
||||||
expect(ghost.previousSibling).toEqual(eventContainer);
|
|
||||||
var hr = ghost.children[0];
|
|
||||||
|
|
||||||
// the first should be the ghost
|
|
||||||
eventContainer = ReactDOM.findDOMNode(tiles[4]).parentNode;
|
|
||||||
expect(found[0].previousSibling).toEqual(eventContainer);
|
|
||||||
|
|
||||||
// the second should be the real thing
|
// the second should be the real thing
|
||||||
eventContainer = ReactDOM.findDOMNode(tiles[4]).parentNode;
|
expect(found[1].previousSibling).toEqual(tileContainers[6]);
|
||||||
expect(ghost.previousSibling).toEqual(eventContainer);
|
|
||||||
|
|
||||||
// advance the clock, and then let the browser run an animation frame,
|
// advance the clock, and then let the browser run an animation frame,
|
||||||
// to let the animation start
|
// to let the animation start
|
||||||
|
Reference in New Issue
Block a user