Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Test typescriptification - MessagePanel (#8943)
Browse files Browse the repository at this point in the history
* mv test/components/structures/MessagePanel-test.js test/components/structures/MessagePanel-test.tsx

* convert simpler messagepanel tests to rtl

* add data-testid to eventlistsummary

* convert read marker tests to rtl

* formatting

* remove commented
  • Loading branch information
Kerry authored Jun 30, 2022
1 parent 78a9841 commit 7a80ea4
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 283 deletions.
1 change: 1 addition & 0 deletions src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,7 @@ class MainGrouper extends BaseGrouper {
ret.push(
<EventListSummary
key={key}
data-testid={key}
events={this.events}
onToggle={panel.onHeightChanged} // Update scroll state
startExpanded={highlightInSummary}
Expand Down
1 change: 1 addition & 0 deletions src/components/views/elements/EventListSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ export default class EventListSummary extends React.Component<IProps> {
);

return <GenericEventListSummary
data-testid={this.props['data-testid']}
events={this.props.events}
threshold={this.props.threshold}
onToggle={this.props.onToggle}
Expand Down
10 changes: 9 additions & 1 deletion src/components/views/elements/GenericEventListSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ interface IProps {
onToggle?(): void;
// The layout currently used
layout?: Layout;
'data-testid'?: string;
}

const GenericEventListSummary: React.FC<IProps> = ({
Expand All @@ -54,6 +55,7 @@ const GenericEventListSummary: React.FC<IProps> = ({
summaryMembers = [],
summaryText,
layout = Layout.Group,
'data-testid': testId,
}) => {
const [expanded, toggleExpanded] = useStateToggle(startExpanded);

Expand Down Expand Up @@ -110,7 +112,13 @@ const GenericEventListSummary: React.FC<IProps> = ({
}

return (
<li className="mx_GenericEventListSummary" data-scroll-tokens={eventIds} data-expanded={expanded + ""} data-layout={layout}>
<li
className="mx_GenericEventListSummary"
data-scroll-tokens={eventIds}
data-expanded={expanded + ""}
data-layout={layout}
data-testid={testId}
>
<AccessibleButton className="mx_GenericEventListSummary_toggle" onClick={toggleExpanded} aria-expanded={expanded}>
{ expanded ? _t('collapse') : _t('expand') }
</AccessibleButton>
Expand Down
Loading

0 comments on commit 7a80ea4

Please sign in to comment.