fix 'data-test' values for chat messages

This commit is contained in:
Ramon Souza 2021-02-17 11:03:28 -03:00
parent d8c5aa46d9
commit 1f2a653af1
2 changed files with 4 additions and 2 deletions

View File

@ -84,6 +84,7 @@ class TimeWindowChatItem extends PureComponent {
text={intlMessages[message.text] ? intl.formatMessage(intlMessages[message.text]) : message.text }
time={message.time}
isSystemMessage={message.id ? true : false}
systemMessageType={message.text === 'PUBLIC_CHAT_CLEAR' ? 'chatClearMessageText' : 'chatWelcomeMessageText'}
chatAreaId={chatAreaId}
handleReadMessage={handleReadMessage}
/>
@ -155,6 +156,7 @@ class TimeWindowChatItem extends PureComponent {
chatAreaId={chatAreaId}
dispatch={dispatch}
read={message.read}
chatUserMessageItem={true}
handleReadMessage={(timestamp) => {
if (!read) {
dispatch({

View File

@ -87,7 +87,6 @@ class MessageChatItem extends PureComponent {
}
handleMessageInViewport() {
if (!this.ticking) {
fastdom.measure(() => {
const node = this.text;
@ -203,6 +202,7 @@ class MessageChatItem extends PureComponent {
className,
isSystemMessage,
chatUserMessageItem,
systemMessageType,
} = this.props;
ChatLogger.debug('MessageChatItem::render', this.props);
if (type === 'poll') return this.renderPollListItem();
@ -212,7 +212,7 @@ class MessageChatItem extends PureComponent {
className={className}
ref={(ref) => { this.text = ref; }}
dangerouslySetInnerHTML={{ __html: text }}
data-test={isSystemMessage ? 'chatWelcomeMessageText' : chatUserMessageItem ? 'chatUserMessageText' : 'chatClearMessageText'}
data-test={isSystemMessage ? systemMessageType : chatUserMessageItem ? 'chatUserMessageText' : ''}
/>
);
}