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

Commit

Permalink
Add room context to test
Browse files Browse the repository at this point in the history
  • Loading branch information
jryans committed Jul 31, 2019
1 parent ddf558b commit c338f8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/views/messages/MessageActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,10 @@ export default class MessageActionBar extends React.PureComponent {
let editButton;

if (isContentActionable(this.props.mxEvent)) {
// `context` can be null in tests that use a subtree of components
// that don't create the context.
if (!this.context || !this.context.room || this.context.room.canReact) {
if (this.context.room.canReact) {
reactButton = this.renderReactButton();
}
if (!this.context || !this.context.room || this.context.room.canReply) {
if (this.context.room.canReply) {
replyButton = <span className="mx_MessageActionBar_maskButton mx_MessageActionBar_replyButton"
title={_t("Reply")}
onClick={this.onReplyClick}
Expand Down
5 changes: 5 additions & 0 deletions test/components/structures/MessagePanel-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ const room = new Matrix.Room();
const WrappedMessagePanel = React.createClass({
childContextTypes: {
matrixClient: React.PropTypes.object,
room: React.PropTypes.object,
},

getChildContext: function() {
return {
matrixClient: client,
room: {
canReact: true,
canReply: true,
},
};
},

Expand Down

0 comments on commit c338f8b

Please sign in to comment.