From efeb6e87c427fda3cebca510ef4aaac86c0a7df0 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 13 Sep 2019 10:32:13 +0100 Subject: [PATCH] Use new React Shallow renderer with hooks support Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/MemberEventListSummary.js | 3 ++- .../components/views/elements/MemberEventListSummary-test.js | 5 +++-- yarn.lock | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/views/elements/MemberEventListSummary.js b/src/components/views/elements/MemberEventListSummary.js index 98adbb2e5c..ef80efaa68 100644 --- a/src/components/views/elements/MemberEventListSummary.js +++ b/src/components/views/elements/MemberEventListSummary.js @@ -22,13 +22,14 @@ import createReactClass from 'create-react-class'; import { _t } from '../../../languageHandler'; import { formatCommaSeparatedList } from '../../../utils/FormattingUtils'; import sdk from "../../../index"; +import {MatrixEvent} from "matrix-js-sdk"; module.exports = createReactClass({ displayName: 'MemberEventListSummary', propTypes: { // An array of member events to summarise - events: PropTypes.array.isRequired, + events: PropTypes.arrayOf(PropTypes.instanceOf(MatrixEvent)).isRequired, // An array of EventTiles to render when expanded children: PropTypes.array.isRequired, // The maximum number of names to show in either each summary e.g. 2 would result "A, B and 234 others left" diff --git a/test/components/views/elements/MemberEventListSummary-test.js b/test/components/views/elements/MemberEventListSummary-test.js index db86b2ffab..95f7e7999a 100644 --- a/test/components/views/elements/MemberEventListSummary-test.js +++ b/test/components/views/elements/MemberEventListSummary-test.js @@ -1,6 +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 * as testUtils from '../../../test-utils'; @@ -112,7 +113,7 @@ describe('MemberEventListSummary', function() { threshold: 3, }; - const renderer = testUtils.getRenderer(); + const renderer = new ShallowRenderer(); renderer.render(); const result = renderer.getRenderOutput(); @@ -134,7 +135,7 @@ describe('MemberEventListSummary', function() { threshold: 3, }; - const renderer = testUtils.getRenderer(); + const renderer = new ShallowRenderer(); renderer.render(); const result = renderer.getRenderOutput(); diff --git a/yarn.lock b/yarn.lock index ba7fea21ba..b2815a496b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6582,6 +6582,11 @@ react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== +react-is@^16.9.0: + version "16.9.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" + integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== + react-lifecycles-compat@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"