Skip to content

Commit 002885a

Browse files
marker-daomarker dao ®
andauthored
Chat: Add MessageBox's height restrictions and scrolling (#31578)
Co-authored-by: marker dao ® <[email protected]>
1 parent 29771bc commit 002885a

File tree

14 files changed

+104
-29
lines changed

14 files changed

+104
-29
lines changed
3.23 KB
Loading
4.55 KB
Loading
900 Bytes
Loading
Loading

e2e/testcafe-devextreme/tests/editors/chat/messageGroup.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import {
99
import url from '../../../helpers/getPageUrl';
1010
import { createWidget } from '../../../helpers/createWidget';
1111
import { testScreenshot } from '../../../helpers/themeUtils';
12-
import { appendElementTo, insertStylesheetRulesToPage, setStyleAttribute } from '../../../helpers/domUtils';
12+
import { appendElementTo, setStyleAttribute } from '../../../helpers/domUtils';
1313
import asyncForEach from '../../../helpers/asyncForEach';
1414

1515
const AVATAR_SELECTOR = '.dx-avatar';
16+
const CHAT_WRAPPER_STYLES = 'display: flex; flex-wrap: wrap; gap: 2px; width: 1270px; padding: 20px; transform: scale(0.9);';
1617

1718
fixture.disablePageReloads`ChatMessageGroup`
1819
.page(url(__dirname, '../../container.html'));
@@ -111,11 +112,9 @@ test('Messagegroup scenarios in disabled state', async (t) => {
111112
const userFirst = createUser(1, 'First');
112113
const userSecond = createUser(2, 'Second');
113114

114-
await insertStylesheetRulesToPage('#container { display: flex; flex-wrap: wrap; gap: 2px; padding: 20px; }');
115-
116115
await asyncForEach([1, 2, 3, 4], async (bubbleCount, idx) => {
117116
const chatId = `#chat_${idx}`;
118-
await appendElementTo('#container', 'div', `chat_${idx}`);
117+
await appendElementTo('#chat-wrapper', 'div', `chat_${idx}`);
119118

120119
const items = generateMessages(bubbleCount, userFirst, userSecond, false, false, 4, 2);
121120

@@ -131,11 +130,14 @@ test('Messagegroup scenarios in disabled state', async (t) => {
131130
await chat.repaint();
132131
});
133132

134-
await testScreenshot(t, takeScreenshot, 'Messagegroup appearance in disabled state.png', { element: '#container' });
133+
await testScreenshot(t, takeScreenshot, 'Messagegroup appearance in disabled state.png', { element: '#chat-wrapper' });
135134

136135
await t
137136
.expect(compareResults.isValid())
138137
.ok(compareResults.errorMessages());
138+
}).before(async () => {
139+
await appendElementTo('#container', 'div', 'chat-wrapper');
140+
await setStyleAttribute(Selector('#chat-wrapper'), CHAT_WRAPPER_STYLES);
139141
});
140142

141143
test('Messagegroup scenarios in RTL mode', async (t) => {
@@ -144,11 +146,9 @@ test('Messagegroup scenarios in RTL mode', async (t) => {
144146
const userFirst = createUser(1, 'First');
145147
const userSecond = createUser(2, 'Second');
146148

147-
await insertStylesheetRulesToPage('#container { display: flex; flex-wrap: wrap; gap: 2px; padding: 20px; }');
148-
149149
await asyncForEach([1, 2, 3, 4], async (bubbleCount, idx) => {
150150
const chatId = `#chat_${idx}`;
151-
await appendElementTo('#container', 'div', `chat_${idx}`);
151+
await appendElementTo('#chat-wrapper', 'div', `chat_${idx}`);
152152

153153
const items = generateMessages(bubbleCount, userFirst, userSecond, false, false, 4, 2);
154154

@@ -164,11 +164,14 @@ test('Messagegroup scenarios in RTL mode', async (t) => {
164164
await chat.repaint(); // NOTE: WA to make it stable in Material theme.
165165
});
166166

167-
await testScreenshot(t, takeScreenshot, 'Messagegroup appearance in RTL mode.png', { element: '#container' });
167+
await testScreenshot(t, takeScreenshot, 'Messagegroup appearance in RTL mode.png', { element: '#chat-wrapper' });
168168

169169
await t
170170
.expect(compareResults.isValid())
171171
.ok(compareResults.errorMessages());
172+
}).before(async () => {
173+
await appendElementTo('#container', 'div', 'chat-wrapper');
174+
await setStyleAttribute(Selector('#chat-wrapper'), CHAT_WRAPPER_STYLES);
172175
});
173176

174177
test('MessageGroup with edited messages', async (t) => {

e2e/testcafe-devextreme/tests/editors/chat/messageList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ test('Messagelist should scrolled to the latest messages after being rendered in
133133

134134
return createWidget('dxTabPanel', {
135135
width: 400,
136-
height: 500,
136+
height: 600,
137137
deferRendering: true,
138138
templatesRenderAsynchronously: true,
139139
dataSource: [{

packages/devextreme-scss/scss/widgets/base/_fileUploader.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
}
101101

102102
.dx-fileuploader-file-container {
103+
display: flex;
104+
align-items: center;
103105
width: 100%;
104106
padding: 4px 0 4px;
105107

@@ -189,7 +191,7 @@
189191
}
190192

191193
.dx-fileuploader-file-size {
192-
margin-left: 4px;
194+
padding-left: 4px;
193195
float: left;
194196
vertical-align: super;
195197
font-size: 10px;
@@ -221,7 +223,7 @@
221223
}
222224

223225
.dx-fileuploader-file-size {
224-
margin-right: 4px;
226+
padding-right: 4px;
225227
}
226228
}
227229
}

packages/devextreme-scss/scss/widgets/base/chat/layout/chat-messagebox/_index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
.dx-placeholder::before {
2222
padding: 0;
2323
}
24+
25+
.dx-texteditor-input {
26+
max-height: 7.1em;
27+
}
2428
}
2529
}
2630
}

packages/devextreme-scss/scss/widgets/base/chat/layout/chat-messagelist/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
.dx-chat-messagelist {
44
flex-grow: 1;
5+
min-height: 3.57em;
56
overflow: hidden;
67

78
.dx-scrollable-container {

packages/devextreme-scss/scss/widgets/base/chat/layout/chat/_index.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
flex-direction: column;
44
width: 100%;
55
height: 100%;
6-
min-width: 20em;
7-
min-height: 20em;
6+
min-width: 22.45em;
7+
min-height: 38em;
8+
overflow-y: auto;
89

910
&.dx-state-disabled {
1011
opacity: 0.5;

0 commit comments

Comments
 (0)