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: Fix avatar positioning #28023

Merged
merged 4 commits into from
Sep 11, 2024
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
47 changes: 45 additions & 2 deletions e2e/testcafe-devextreme/tests/chat/common.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Selector } from 'testcafe';
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
import url from '../../helpers/getPageUrl';
import { createWidget } from '../../helpers/createWidget';
import { testScreenshot } from '../../helpers/themeUtils';
import { appendElementTo } from '../../helpers/domUtils';
import { appendElementTo, setStyleAttribute } from '../../helpers/domUtils';

const CHAT_AVATAR_SELECTOR = '.dx-chat-message-avatar';

fixture.disablePageReloads`Chat`
.page(url(__dirname, '../container.html'));

test('Chat: line breaks', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
await testScreenshot(t, takeScreenshot, 'Chat message bubble line breaks.png', { element: '#container' });
await testScreenshot(t, takeScreenshot, 'Chat message bubble line breaks.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
Expand All @@ -27,3 +30,43 @@ test('Chat: line breaks', async (t) => {
],
}, '#chat');
});

test('Chat: avatar rendering', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);

await testScreenshot(t, takeScreenshot, 'Avatar has correct position.png', { element: '#chat' });

await setStyleAttribute(Selector(CHAT_AVATAR_SELECTOR), 'width: 64px; height: 64px');

await testScreenshot(t, takeScreenshot, 'Avatar sizes do not affect indentation between bubbles.png', { element: '#chat' });

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}).before(async () => {
await appendElementTo('#container', 'div', 'chat');

const author = {
id: 1,
name: 'First User Name',
};
const timestamp = new Date(1721747399083);
const text = '0.392722124265449';

return createWidget('dxChat', {
height: 500,
width: 400,
items: [
{
timestamp,
text,
author,
},
{
timestamp,
text,
author,
},
],
}, '#chat');
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.dx-chat-message-avatar {
grid-row: span 3;
grid-row: 2 / auto;
display: flex;
align-items: center;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

.dx-chat-message-group-alignment-start {
.dx-chat-message-bubble-container {
grid-column: 2;
align-items: flex-start;
}

Expand Down
Loading