Skip to content

Commit

Permalink
Chat: Skip message rendering on send message (#28170)
Browse files Browse the repository at this point in the history
Co-authored-by: marker dao ® <[email protected]>
  • Loading branch information
marker-dao and marker dao ® authored Oct 11, 2024
1 parent 044571c commit a64be34
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
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

0 comments on commit a64be34

Please sign in to comment.