Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat: Skip message rendering on send message #28170

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions e2e/testcafe-devextreme/tests/chat/messageList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ test('Messagelist appearance with scrollbar', async (t) => {
user: userSecond,
width: 400,
height: 600,
onMessageSend: (e) => {
const { component, message } = e;

component.renderMessage(message);
},
});
});

Expand Down
1 change: 0 additions & 1 deletion packages/devextreme/js/__internal/ui/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ class Chat extends Widget<Properties> {
text,
};

this.renderMessage(message);
this._messageSendAction?.({ message, event });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,20 @@ QUnit.module('Chat', moduleConfig, () => {
assert.strictEqual(onMessageSend.callCount, 1);
});

QUnit.test('new message should be created after clicking the send button', function(assert) {
QUnit.test('new message should not be created after clicking the send button', function(assert) {
const text = 'new text message';

keyboardMock(this.$input)
.focus()
.type(text);

const numberOfMessagesBefore = this.getBubbles().length;

this.$sendButton.trigger('dxclick');

const $bubbles = this.getBubbles();
const bubble = $bubbles[$bubbles.length - 1];
const numberOfMessagesAfter = this.getBubbles().length;

assert.strictEqual($(bubble).text(), text);
assert.strictEqual(numberOfMessagesAfter, numberOfMessagesBefore);
});

QUnit.test('New message should be correct after clicking the send button', function(assert) {
Expand Down
Loading