Add room context to test

This commit is contained in:
J. Ryan Stinnett 2019-07-31 11:17:24 +01:00
parent ddf558b3ed
commit c338f8bf1f
2 changed files with 7 additions and 4 deletions

View file

@ -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}

View file

@ -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,
},
};
},