@@ -3,7 +3,7 @@ import React from 'react';
3
3
import Trigger , { UniqueProvider , type UniqueProviderProps } from '../src' ;
4
4
import { awaitFakeTimer } from './util' ;
5
5
import type { TriggerProps } from '../src' ;
6
- import classNames from 'classnames ' ;
6
+ import { clsx } from 'clsx ' ;
7
7
8
8
// Mock UniqueContainer to check if open props changed
9
9
global . openChangeLog = [ ] ;
@@ -185,21 +185,30 @@ describe('Trigger.Unique', () => {
185
185
} ) ;
186
186
187
187
it ( 'should apply uniqueContainerClassName to UniqueContainer component' , async ( ) => {
188
- await setupAndOpenPopup ( { uniqueContainerClassName : 'custom-container-class' } ) ;
188
+ await setupAndOpenPopup ( {
189
+ uniqueContainerClassName : 'custom-container-class' ,
190
+ } ) ;
189
191
190
192
// Check that UniqueContainer has the custom container className
191
- const uniqueContainer = document . querySelector ( '.rc-trigger-popup-unique-container' ) ;
193
+ const uniqueContainer = document . querySelector (
194
+ '.rc-trigger-popup-unique-container' ,
195
+ ) ;
192
196
expect ( uniqueContainer ) . toBeTruthy ( ) ;
193
197
expect ( uniqueContainer . className ) . toContain ( 'custom-container-class' ) ;
194
198
} ) ;
195
199
196
200
it ( 'should apply uniqueContainerStyle to UniqueContainer component' , async ( ) => {
197
201
await setupAndOpenPopup ( {
198
- uniqueContainerStyle : { backgroundColor : 'red' , border : '1px solid blue' } ,
202
+ uniqueContainerStyle : {
203
+ backgroundColor : 'red' ,
204
+ border : '1px solid blue' ,
205
+ } ,
199
206
} ) ;
200
207
201
208
// Check that UniqueContainer has the custom container style
202
- const uniqueContainer = document . querySelector ( '.rc-trigger-popup-unique-container' ) ;
209
+ const uniqueContainer = document . querySelector (
210
+ '.rc-trigger-popup-unique-container' ,
211
+ ) ;
203
212
expect ( uniqueContainer ) . toBeTruthy ( ) ;
204
213
expect ( uniqueContainer ) . toHaveStyle ( {
205
214
backgroundColor : 'red' ,
@@ -211,7 +220,9 @@ describe('Trigger.Unique', () => {
211
220
await setupAndOpenPopup ( ) ;
212
221
213
222
// Check that UniqueContainer exists but does not have custom container className
214
- const uniqueContainer = document . querySelector ( '.rc-trigger-popup-unique-container' ) ;
223
+ const uniqueContainer = document . querySelector (
224
+ '.rc-trigger-popup-unique-container' ,
225
+ ) ;
215
226
expect ( uniqueContainer ) . toBeTruthy ( ) ;
216
227
expect ( uniqueContainer . className ) . not . toContain ( 'undefined' ) ;
217
228
} ) ;
@@ -246,12 +257,14 @@ describe('Trigger.Unique', () => {
246
257
) ;
247
258
248
259
expect ( document . querySelector ( '.rc-trigger-popup' ) ) . toHaveClass ( 'bamboo' ) ;
249
- expect ( document . querySelector ( '.rc-trigger-popup-unique-container' ) ) . toHaveClass (
250
- 'bamboo' ,
251
- ) ;
260
+ expect (
261
+ document . querySelector ( '.rc-trigger-popup-unique-container' ) ,
262
+ ) . toHaveClass ( 'bamboo' ) ;
252
263
253
264
// Check that arrow position CSS variables are set
254
- const uniqueContainer = document . querySelector ( '.rc-trigger-popup-unique-container' ) ;
265
+ const uniqueContainer = document . querySelector (
266
+ '.rc-trigger-popup-unique-container' ,
267
+ ) ;
255
268
const computedStyle = getComputedStyle ( uniqueContainer ) ;
256
269
expect ( computedStyle . getPropertyValue ( '--arrow-x' ) ) . not . toBe ( '' ) ;
257
270
expect ( computedStyle . getPropertyValue ( '--arrow-y' ) ) . not . toBe ( '' ) ;
@@ -262,10 +275,7 @@ describe('Trigger.Unique', () => {
262
275
options ,
263
276
) => ( {
264
277
...options ,
265
- popupClassName : classNames (
266
- options . popupClassName ,
267
- 'custom-post-options-class' ,
268
- ) ,
278
+ popupClassName : clsx ( options . popupClassName , 'custom-post-options-class' ) ,
269
279
} ) ;
270
280
271
281
render (
@@ -293,7 +303,7 @@ describe('Trigger.Unique', () => {
293
303
// Mock useAlign to return our mock onAlign function
294
304
const useAlignModule = require ( '../src/hooks/useAlign' ) ;
295
305
const originalUseAlign = useAlignModule . default ;
296
-
306
+
297
307
jest . spyOn ( useAlignModule , 'default' ) . mockImplementation ( ( ...args ) => {
298
308
const originalResult = originalUseAlign ( ...args ) ;
299
309
// Replace onAlign with our mock
@@ -319,7 +329,7 @@ describe('Trigger.Unique', () => {
319
329
320
330
return (
321
331
< div >
322
- < button
332
+ < button
323
333
className = "switch-trigger-btn"
324
334
onClick = { ( ) => {
325
335
// Switch which trigger is open - this changes the target
0 commit comments