From e470e0f3e71e3b91d52cc948fc8f8e9652e4120e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marker=20dao=20=C2=AE?= Date: Thu, 10 Oct 2024 12:09:48 +0200 Subject: [PATCH] Chat: Skip message rendering in onMessageSend --- packages/devextreme/js/__internal/ui/chat/chat.ts | 1 - .../tests/DevExpress.ui.widgets/chatParts/chat.tests.js | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/devextreme/js/__internal/ui/chat/chat.ts b/packages/devextreme/js/__internal/ui/chat/chat.ts index 25efed0b35df..4a214ff9b74e 100644 --- a/packages/devextreme/js/__internal/ui/chat/chat.ts +++ b/packages/devextreme/js/__internal/ui/chat/chat.ts @@ -166,7 +166,6 @@ class Chat extends Widget { text, }; - this.renderMessage(message); this._messageSendAction?.({ message, event }); } diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/chat.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/chat.tests.js index dd4991c32456..0fd3daca147e 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/chat.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/chat.tests.js @@ -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) {