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

Commit

Permalink
convert MPollBody tests into rtl (#9906)
Browse files Browse the repository at this point in the history
* convert MPollBody tests into rtl

* strict fixes

* more strict

* more semantic assertions

* update types for extensible events changes
  • Loading branch information
Kerry authored Jan 16, 2023
1 parent 0758b8c commit 33e8a62
Show file tree
Hide file tree
Showing 3 changed files with 1,422 additions and 2,396 deletions.
13 changes: 10 additions & 3 deletions src/components/views/messages/MPollBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export default class MPollBody extends React.Component<IBodyProps, IState> {

return (
<div className="mx_MPollBody">
<h2>
<h2 data-testid="pollQuestion">
{poll.question.text}
{editedSpan}
</h2>
Expand All @@ -471,7 +471,12 @@ export default class MPollBody extends React.Component<IBodyProps, IState> {

const answerPercent = totalVotes === 0 ? 0 : Math.round((100.0 * answerVotes) / totalVotes);
return (
<div key={answer.id} className={cls} onClick={() => this.selectOption(answer.id)}>
<div
data-testid={`pollOption-${answer.id}`}
key={answer.id}
className={cls}
onClick={() => this.selectOption(answer.id)}
>
{ended ? (
<EndedPollOption answer={answer} checked={checked} votesText={votesText} />
) : (
Expand All @@ -493,7 +498,9 @@ export default class MPollBody extends React.Component<IBodyProps, IState> {
);
})}
</div>
<div className="mx_MPollBody_totalVotes">{totalText}</div>
<div data-testid="totalVotes" className="mx_MPollBody_totalVotes">
{totalText}
</div>
</div>
);
}
Expand Down
Loading

0 comments on commit 33e8a62

Please sign in to comment.