@@ -125,9 +125,9 @@ describe('Trigger.Unique', () => {
125125
126126 // There should only be one popup element
127127 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 ) ;
131131
132132 // FloatBg open prop should not have changed during transition (no close animation)
133133 expect ( global . openChangeLog ) . toHaveLength ( 0 ) ;
@@ -192,7 +192,9 @@ describe('Trigger.Unique', () => {
192192 } ) ;
193193
194194 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+ } ) ;
196198
197199 // Check that UniqueBody has the custom background style
198200 const uniqueBody = document . querySelector ( '.rc-trigger-popup-unique-body' ) ;
@@ -211,4 +213,38 @@ describe('Trigger.Unique', () => {
211213 expect ( uniqueBody ) . toBeTruthy ( ) ;
212214 expect ( uniqueBody . className ) . not . toContain ( 'undefined' ) ;
213215 } ) ;
216+
217+ it ( 'should pass alignedClassName on unique body' , async ( ) => {
218+ const getPopupClassNameFromAlign = ( ) => 'bamboo' ;
219+
220+ render (
221+ < UniqueProvider >
222+ < Trigger
223+ action = { [ 'click' ] }
224+ popup = { < strong className = "x-content" > tooltip</ strong > }
225+ unique
226+ popupVisible
227+ popupPlacement = "bottomLeft"
228+ getPopupClassNameFromAlign = { getPopupClassNameFromAlign }
229+ builtinPlacements = { {
230+ bottomLeft : {
231+ points : [ 'tl' , 'bl' ] ,
232+ offset : [ 0 , 4 ] ,
233+ overflow : {
234+ adjustX : 0 ,
235+ adjustY : 1 ,
236+ } ,
237+ } ,
238+ } }
239+ >
240+ < div className = "target" > click me</ div >
241+ </ Trigger >
242+ </ UniqueProvider > ,
243+ ) ;
244+
245+ expect ( document . querySelector ( '.rc-trigger-popup' ) ) . toHaveClass ( 'bamboo' ) ;
246+ expect ( document . querySelector ( '.rc-trigger-popup-unique-body' ) ) . toHaveClass (
247+ 'bamboo' ,
248+ ) ;
249+ } ) ;
214250} ) ;
0 commit comments