@@ -56,7 +56,7 @@ describe('Mentions', () => {
56
56
57
57
it ( 'not lose focus if click on dropdown' , ( ) => {
58
58
const onBlur = jest . fn ( ) ;
59
- const { container } = renderMentions ( {
59
+ const { container, baseElement } = renderMentions ( {
60
60
autoFocus : true ,
61
61
defaultValue : '@' ,
62
62
onBlur,
@@ -69,11 +69,11 @@ describe('Mentions', () => {
69
69
} ) ;
70
70
71
71
fireEvent . focus (
72
- container . querySelector ( 'li.rc-mentions-dropdown-menu-item' ) ,
72
+ baseElement . querySelector ( 'li.rc-mentions-dropdown-menu-item' ) ,
73
73
) ;
74
74
fireEvent . blur ( container . querySelector ( 'textarea' ) ) ;
75
75
fireEvent . click (
76
- container . querySelector ( 'li.rc-mentions-dropdown-menu-item' ) ,
76
+ baseElement . querySelector ( 'li.rc-mentions-dropdown-menu-item' ) ,
77
77
) ;
78
78
fireEvent . focus ( container . querySelector ( 'textarea' ) ) ;
79
79
@@ -177,13 +177,15 @@ describe('Mentions', () => {
177
177
} ) ;
178
178
179
179
it ( 'do not lose label' , ( ) => {
180
- const { container } = renderOptionsMentions ( ) ;
180
+ const { container, baseElement } = renderOptionsMentions ( ) ;
181
181
simulateInput ( container , '@' ) ;
182
182
fireEvent . mouseEnter (
183
- container . querySelector ( 'li.rc-mentions-dropdown-menu-item:last-child' ) ,
183
+ baseElement . querySelector (
184
+ 'li.rc-mentions-dropdown-menu-item:last-child' ,
185
+ ) ,
184
186
) ;
185
187
expect (
186
- container . querySelector ( '.rc-mentions-dropdown-menu-item-active' )
188
+ baseElement . querySelector ( '.rc-mentions-dropdown-menu-item-active' )
187
189
. textContent ,
188
190
) . toBe ( 'Cat' ) ;
189
191
} ) ;
@@ -224,33 +226,37 @@ describe('Mentions', () => {
224
226
225
227
describe ( 'accessibility' , ( ) => {
226
228
it ( 'hover' , ( ) => {
227
- const { container } = renderMentions ( ) ;
229
+ const { container, baseElement } = renderMentions ( ) ;
228
230
simulateInput ( container , '@' ) ;
229
231
fireEvent . mouseEnter (
230
- container . querySelector ( 'li.rc-mentions-dropdown-menu-item:last-child' ) ,
232
+ baseElement . querySelector (
233
+ 'li.rc-mentions-dropdown-menu-item:last-child' ,
234
+ ) ,
231
235
) ;
232
236
expect (
233
- container . querySelector ( '.rc-mentions-dropdown-menu-item-active' )
237
+ baseElement . querySelector ( '.rc-mentions-dropdown-menu-item-active' )
234
238
. textContent ,
235
239
) . toBe ( 'Cat' ) ;
236
240
} ) ;
237
241
} ) ;
238
242
239
243
it ( 'dropdownClassName should work' , ( ) => {
240
- const { container } = renderMentions ( { dropdownClassName : 'my-dropdown' } ) ;
244
+ const { container, baseElement } = renderMentions ( {
245
+ dropdownClassName : 'my-dropdown' ,
246
+ } ) ;
241
247
simulateInput ( container , '@' ) ;
242
248
expect (
243
- container . querySelector ( '.my-dropdown.rc-mentions-dropdown' ) ,
249
+ baseElement . querySelector ( '.my-dropdown.rc-mentions-dropdown' ) ,
244
250
) . toBeTruthy ( ) ;
245
251
} ) ;
246
252
247
253
it ( 'should support direction' , ( ) => {
248
- const { container } = renderMentions ( { direction : 'rtl' } ) ;
254
+ const { container, baseElement } = renderMentions ( { direction : 'rtl' } ) ;
249
255
simulateInput ( container , '@' ) ;
250
256
act ( ( ) => {
251
257
jest . runAllTimers ( ) ;
252
258
} ) ;
253
- expect ( container . querySelector ( '.rc-mentions-dropdown' ) ) . toBeTruthy ( ) ;
259
+ expect ( baseElement . querySelector ( '.rc-mentions-dropdown' ) ) . toBeTruthy ( ) ;
254
260
} ) ;
255
261
256
262
it ( 'should support textarea in ref' , ( ) => {
0 commit comments