mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 19:26:04 +03:00
Add room
context to test
This commit is contained in:
parent
ddf558b3ed
commit
c338f8bf1f
2 changed files with 7 additions and 4 deletions
|
@ -145,12 +145,10 @@ export default class MessageActionBar extends React.PureComponent {
|
||||||
let editButton;
|
let editButton;
|
||||||
|
|
||||||
if (isContentActionable(this.props.mxEvent)) {
|
if (isContentActionable(this.props.mxEvent)) {
|
||||||
// `context` can be null in tests that use a subtree of components
|
if (this.context.room.canReact) {
|
||||||
// that don't create the context.
|
|
||||||
if (!this.context || !this.context.room || this.context.room.canReact) {
|
|
||||||
reactButton = this.renderReactButton();
|
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"
|
replyButton = <span className="mx_MessageActionBar_maskButton mx_MessageActionBar_replyButton"
|
||||||
title={_t("Reply")}
|
title={_t("Reply")}
|
||||||
onClick={this.onReplyClick}
|
onClick={this.onReplyClick}
|
||||||
|
|
|
@ -41,11 +41,16 @@ const room = new Matrix.Room();
|
||||||
const WrappedMessagePanel = React.createClass({
|
const WrappedMessagePanel = React.createClass({
|
||||||
childContextTypes: {
|
childContextTypes: {
|
||||||
matrixClient: React.PropTypes.object,
|
matrixClient: React.PropTypes.object,
|
||||||
|
room: React.PropTypes.object,
|
||||||
},
|
},
|
||||||
|
|
||||||
getChildContext: function() {
|
getChildContext: function() {
|
||||||
return {
|
return {
|
||||||
matrixClient: client,
|
matrixClient: client,
|
||||||
|
room: {
|
||||||
|
canReact: true,
|
||||||
|
canReply: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue