From b9a5e962415b25c1a98b675fd21cdbe02cf52e71 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 21 Apr 2022 09:40:21 +0100 Subject: [PATCH] Add test and remove unused method --- src/components/structures/MessagePanel.tsx | 8 ---- .../structures/MessagePanel-test.js | 39 ++++++++++++++++++- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/components/structures/MessagePanel.tsx b/src/components/structures/MessagePanel.tsx index ff9bc826528..8600da90475 100644 --- a/src/components/structures/MessagePanel.tsx +++ b/src/components/structures/MessagePanel.tsx @@ -452,14 +452,6 @@ export default class MessagePanel extends React.Component { } } - /* check the scroll state and send out pagination requests if necessary. - */ - public checkFillState(): void { - if (this.scrollPanel.current) { - this.scrollPanel.current.checkFillState(); - } - } - private isUnmounting = (): boolean => { return !this.isMounted; }; diff --git a/test/components/structures/MessagePanel-test.js b/test/components/structures/MessagePanel-test.js index 3c774290005..eca8c39bec9 100644 --- a/test/components/structures/MessagePanel-test.js +++ b/test/components/structures/MessagePanel-test.js @@ -44,6 +44,8 @@ class WrappedMessagePanel extends React.Component { callEventGroupers = new Map(); render() { + const { showHiddenEvents, ...props } = this.props; + const roomContext = { room, roomId: room.roomId, @@ -54,13 +56,14 @@ class WrappedMessagePanel extends React.Component { showJoinLeaves: false, showAvatarChanges: false, showDisplaynameChanges: true, + showHiddenEvents, }; return @@ -633,6 +636,40 @@ describe('MessagePanel', function() { expect(settingsSpy).not.toHaveBeenCalledWith("showHiddenEventsInTimeline"); settingsSpy.mockRestore(); }); + + it("should group hidden event reactions into an event list summary", () => { + const events = [ + TestUtilsMatrix.mkEvent({ + event: true, + type: "m.reaction", + room: "!room:id", + user: "@user:id", + content: {}, + ts: 1, + }), + TestUtilsMatrix.mkEvent({ + event: true, + type: "m.reaction", + room: "!room:id", + user: "@user:id", + content: {}, + ts: 2, + }), + TestUtilsMatrix.mkEvent({ + event: true, + type: "m.reaction", + room: "!room:id", + user: "@user:id", + content: {}, + ts: 3, + }), + ]; + const res = mount(); + + const els = res.find("EventListSummary"); + expect(els.length).toEqual(1); + expect(els.prop("events").length).toEqual(3); + }); }); describe("shouldFormContinuation", () => {