@@ -125,9 +125,9 @@ describe('Trigger.Unique', () => {
125
125
126
126
// There should only be one popup element
127
127
expect ( document . querySelectorAll ( '.rc-trigger-popup' ) . length ) . toBe ( 1 ) ;
128
- expect ( document . querySelectorAll ( '.rc-trigger-popup-unique-body' ) . length ) . toBe (
129
- 1 ,
130
- ) ;
128
+ expect (
129
+ document . querySelectorAll ( '.rc-trigger-popup-unique-body' ) . length ,
130
+ ) . toBe ( 1 ) ;
131
131
132
132
// FloatBg open prop should not have changed during transition (no close animation)
133
133
expect ( global . openChangeLog ) . toHaveLength ( 0 ) ;
@@ -192,7 +192,9 @@ describe('Trigger.Unique', () => {
192
192
} ) ;
193
193
194
194
it ( 'should apply uniqueBgStyle to UniqueBody component' , async ( ) => {
195
- await setupAndOpenPopup ( { uniqueBgStyle : { backgroundColor : 'red' , border : '1px solid blue' } } ) ;
195
+ await setupAndOpenPopup ( {
196
+ uniqueBgStyle : { backgroundColor : 'red' , border : '1px solid blue' } ,
197
+ } ) ;
196
198
197
199
// Check that UniqueBody has the custom background style
198
200
const uniqueBody = document . querySelector ( '.rc-trigger-popup-unique-body' ) ;
@@ -213,17 +215,17 @@ describe('Trigger.Unique', () => {
213
215
} ) ;
214
216
215
217
it ( 'should combine alignedClassName with uniqueBgClassName' , async ( ) => {
216
- const getPopupClassNameFromAlign = ( align : any ) => {
217
- return `custom-align-${ align . points ?. [ 0 ] || 'default' } ` ;
218
- } ;
218
+ const getPopupClassNameFromAlign = ( ) => 'bamboo' ;
219
219
220
- const { container } = render (
220
+ render (
221
221
< UniqueProvider >
222
222
< Trigger
223
223
action = { [ 'click' ] }
224
224
popup = { < strong className = "x-content" > tooltip</ strong > }
225
225
unique
226
+ popupVisible
226
227
popupPlacement = "bottomLeft"
228
+ getPopupClassNameFromAlign = { getPopupClassNameFromAlign }
227
229
builtinPlacements = { {
228
230
bottomLeft : {
229
231
points : [ 'tl' , 'bl' ] ,
@@ -234,33 +236,15 @@ describe('Trigger.Unique', () => {
234
236
} ,
235
237
} ,
236
238
} }
237
- getPopupClassNameFromAlign = { getPopupClassNameFromAlign }
238
- uniqueBgClassName = "custom-bg-class"
239
239
>
240
240
< div className = "target" > click me</ div >
241
241
</ Trigger >
242
242
</ UniqueProvider > ,
243
243
) ;
244
244
245
- // Initially no popup should be visible
246
- expect ( document . querySelector ( '.rc-trigger-popup' ) ) . toBeFalsy ( ) ;
247
-
248
- // Click trigger to show popup
249
- fireEvent . click ( container . querySelector ( '.target' ) ) ;
250
- await awaitFakeTimer ( ) ;
251
-
252
- // Wait a bit more for alignment to complete
253
- await awaitFakeTimer ( ) ;
254
-
255
- // Check that popup exists
256
- const popup = document . querySelector ( '.rc-trigger-popup' ) ;
257
- expect ( popup ) . toBeTruthy ( ) ;
258
- expect ( popup . querySelector ( '.x-content' ) . textContent ) . toBe ( 'tooltip' ) ;
259
-
260
- // Check that both custom background className and aligned className are applied to UniqueBody
261
- const uniqueBody = document . querySelector ( '.rc-trigger-popup-unique-body' ) ;
262
- expect ( uniqueBody ) . toBeTruthy ( ) ;
263
- expect ( uniqueBody . className ) . toContain ( 'custom-bg-class' ) ;
264
- expect ( uniqueBody . className ) . toContain ( 'custom-align' ) ;
245
+ expect ( document . querySelector ( '.rc-trigger-popup' ) ) . toHaveClass ( 'bamboo' ) ;
246
+ expect ( document . querySelector ( '.rc-trigger-popup-unique-body' ) ) . toHaveClass (
247
+ 'bamboo' ,
248
+ ) ;
265
249
} ) ;
266
250
} ) ;
0 commit comments