@@ -20,6 +20,7 @@ import {
20
20
ChannelStateProvider ,
21
21
ChatProvider ,
22
22
ComponentProvider ,
23
+ DialogsManagerProvider ,
23
24
TranslationProvider ,
24
25
useMessageContext ,
25
26
} from '../../../context' ;
@@ -38,7 +39,11 @@ const Wrapper = ({ children, componentContext = {} }) => (
38
39
< ChatProvider value = { { client } } >
39
40
< ChannelStateProvider value = { { channel } } >
40
41
< ChannelActionProvider value = { { addNotification : jest . fn ( ) } } >
41
- < ComponentProvider value = { componentContext } > { children } </ ComponentProvider >
42
+ < ComponentProvider value = { componentContext } >
43
+ < DialogsManagerProvider id = 'vml-components-dialogs-manager' >
44
+ { children }
45
+ </ DialogsManagerProvider >
46
+ </ ComponentProvider >
42
47
</ ChannelActionProvider >
43
48
</ ChannelStateProvider >
44
49
</ ChatProvider >
@@ -84,7 +89,16 @@ describe('VirtualizedMessageComponents', () => {
84
89
const CustomLoadingIndicator = ( ) => < div > Custom Loading Indicator</ div > ;
85
90
it ( 'should render empty div in Header when not loading more messages' , ( ) => {
86
91
const { container } = renderElements ( < Header /> ) ;
87
- expect ( container ) . toMatchInlineSnapshot ( `<div />` ) ;
92
+ expect ( container ) . toMatchInlineSnapshot ( `
93
+ <div>
94
+ <div
95
+ class="str-chat__dialog-overlay"
96
+ data-str-chat__portal-id="vml-components-dialogs-manager"
97
+ data-testid="str-chat__dialog-overlay"
98
+ style="--str-chat__dialog-overlay-height: 0;"
99
+ />
100
+ </div>
101
+ ` ) ;
88
102
} ) ;
89
103
90
104
it ( 'should render LoadingIndicator in Header when loading more messages' , ( ) => {
@@ -106,14 +120,29 @@ describe('VirtualizedMessageComponents', () => {
106
120
Custom Loading Indicator
107
121
</div>
108
122
</div>
123
+ <div
124
+ class="str-chat__dialog-overlay"
125
+ data-str-chat__portal-id="vml-components-dialogs-manager"
126
+ data-testid="str-chat__dialog-overlay"
127
+ style="--str-chat__dialog-overlay-height: 0;"
128
+ />
109
129
</div>
110
130
` ) ;
111
131
} ) ;
112
132
113
133
it ( 'should not render custom LoadingIndicator in Header when not loading more messages' , ( ) => {
114
134
const componentContext = { LoadingIndicator : CustomLoadingIndicator } ;
115
135
const { container } = renderElements ( < Header /> , componentContext ) ;
116
- expect ( container ) . toMatchInlineSnapshot ( `<div />` ) ;
136
+ expect ( container ) . toMatchInlineSnapshot ( `
137
+ <div>
138
+ <div
139
+ class="str-chat__dialog-overlay"
140
+ data-str-chat__portal-id="vml-components-dialogs-manager"
141
+ data-testid="str-chat__dialog-overlay"
142
+ style="--str-chat__dialog-overlay-height: 0;"
143
+ />
144
+ </div>
145
+ ` ) ;
117
146
} ) ;
118
147
119
148
// FIXME: this is a crazy pattern of having to set LoadingIndicator to null so that additionalVirtuosoProps.head can be rendered.
@@ -135,14 +164,29 @@ describe('VirtualizedMessageComponents', () => {
135
164
<div>
136
165
Custom head
137
166
</div>
167
+ <div
168
+ class="str-chat__dialog-overlay"
169
+ data-str-chat__portal-id="vml-components-dialogs-manager"
170
+ data-testid="str-chat__dialog-overlay"
171
+ style="--str-chat__dialog-overlay-height: 0;"
172
+ />
138
173
</div>
139
174
` ) ;
140
175
} ) ;
141
176
142
177
it ( 'should not render custom head in Header when not loading more messages' , ( ) => {
143
178
const context = { head } ;
144
179
const { container } = renderElements ( < Header context = { context } /> ) ;
145
- expect ( container ) . toMatchInlineSnapshot ( `<div />` ) ;
180
+ expect ( container ) . toMatchInlineSnapshot ( `
181
+ <div>
182
+ <div
183
+ class="str-chat__dialog-overlay"
184
+ data-str-chat__portal-id="vml-components-dialogs-manager"
185
+ data-testid="str-chat__dialog-overlay"
186
+ style="--str-chat__dialog-overlay-height: 0;"
187
+ />
188
+ </div>
189
+ ` ) ;
146
190
} ) ;
147
191
148
192
it ( 'should render custom LoadingIndicator instead of head when loading more' , ( ) => {
@@ -158,6 +202,12 @@ describe('VirtualizedMessageComponents', () => {
158
202
Custom Loading Indicator
159
203
</div>
160
204
</div>
205
+ <div
206
+ class="str-chat__dialog-overlay"
207
+ data-str-chat__portal-id="vml-components-dialogs-manager"
208
+ data-testid="str-chat__dialog-overlay"
209
+ style="--str-chat__dialog-overlay-height: 0;"
210
+ />
161
211
</div>
162
212
` ) ;
163
213
} ) ;
@@ -176,7 +226,16 @@ describe('VirtualizedMessageComponents', () => {
176
226
177
227
it ( 'should render empty for thread by default' , ( ) => {
178
228
const { container } = renderElements ( < EmptyPlaceholder context = { { threadList : true } } /> ) ;
179
- expect ( container ) . toMatchInlineSnapshot ( `<div />` ) ;
229
+ expect ( container ) . toMatchInlineSnapshot ( `
230
+ <div>
231
+ <div
232
+ class="str-chat__dialog-overlay"
233
+ data-str-chat__portal-id="vml-components-dialogs-manager"
234
+ data-testid="str-chat__dialog-overlay"
235
+ style="--str-chat__dialog-overlay-height: 0;"
236
+ />
237
+ </div>
238
+ ` ) ;
180
239
} ) ;
181
240
it ( 'should render custom EmptyStateIndicator for main message list' , ( ) => {
182
241
const { container } = renderElements ( < EmptyPlaceholder /> , componentContext ) ;
@@ -194,7 +253,16 @@ describe('VirtualizedMessageComponents', () => {
194
253
it ( 'should render empty if EmptyStateIndicator nullified' , ( ) => {
195
254
const componentContext = { EmptyStateIndicator : NullEmptyStateIndicator } ;
196
255
const { container } = renderElements ( < EmptyPlaceholder /> , componentContext ) ;
197
- expect ( container ) . toMatchInlineSnapshot ( `<div />` ) ;
256
+ expect ( container ) . toMatchInlineSnapshot ( `
257
+ <div>
258
+ <div
259
+ class="str-chat__dialog-overlay"
260
+ data-str-chat__portal-id="vml-components-dialogs-manager"
261
+ data-testid="str-chat__dialog-overlay"
262
+ style="--str-chat__dialog-overlay-height: 0;"
263
+ />
264
+ </div>
265
+ ` ) ;
198
266
} ) ;
199
267
200
268
it ( 'should render empty in thread if EmptyStateIndicator nullified' , ( ) => {
@@ -203,14 +271,32 @@ describe('VirtualizedMessageComponents', () => {
203
271
< EmptyPlaceholder context = { { threadList : true } } /> ,
204
272
componentContext ,
205
273
) ;
206
- expect ( container ) . toMatchInlineSnapshot ( `<div />` ) ;
274
+ expect ( container ) . toMatchInlineSnapshot ( `
275
+ <div>
276
+ <div
277
+ class="str-chat__dialog-overlay"
278
+ data-str-chat__portal-id="vml-components-dialogs-manager"
279
+ data-testid="str-chat__dialog-overlay"
280
+ style="--str-chat__dialog-overlay-height: 0;"
281
+ />
282
+ </div>
283
+ ` ) ;
207
284
} ) ;
208
285
} ) ;
209
286
210
287
describe ( 'Footer' , ( ) => {
211
288
it ( 'should render nothing in Footer by default' , ( ) => {
212
289
const { container } = renderElements ( < Footer /> ) ;
213
- expect ( container ) . toMatchInlineSnapshot ( `<div />` ) ;
290
+ expect ( container ) . toMatchInlineSnapshot ( `
291
+ <div>
292
+ <div
293
+ class="str-chat__dialog-overlay"
294
+ data-str-chat__portal-id="vml-components-dialogs-manager"
295
+ data-testid="str-chat__dialog-overlay"
296
+ style="--str-chat__dialog-overlay-height: 0;"
297
+ />
298
+ </div>
299
+ ` ) ;
214
300
} ) ;
215
301
it ( 'should render custom TypingIndicator in Footer' , ( ) => {
216
302
const TypingIndicator = ( ) => < div > Custom TypingIndicator</ div > ;
@@ -221,6 +307,12 @@ describe('VirtualizedMessageComponents', () => {
221
307
<div>
222
308
Custom TypingIndicator
223
309
</div>
310
+ <div
311
+ class="str-chat__dialog-overlay"
312
+ data-str-chat__portal-id="vml-components-dialogs-manager"
313
+ data-testid="str-chat__dialog-overlay"
314
+ style="--str-chat__dialog-overlay-height: 0;"
315
+ />
224
316
</div>
225
317
` ) ;
226
318
} ) ;
0 commit comments