File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed
Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -128,8 +128,10 @@ export default function useAlign(
128128 const win = getWin ( popupElement ) ;
129129
130130 // Placement
131- const placementInfo : AlignType =
132- builtinPlacements [ placement ] || popupAlign || { } ;
131+ const placementInfo : AlignType = {
132+ ...builtinPlacements [ placement ] ,
133+ ...popupAlign ,
134+ } ;
133135
134136 // Reset first
135137 popupElement . style . left = '0' ;
Original file line number Diff line number Diff line change @@ -176,4 +176,33 @@ describe('Trigger.Align', () => {
176176 await awaitFakeTimer ( ) ;
177177 expect ( onPopupAlign ) . not . toHaveBeenCalled ( ) ;
178178 } ) ;
179+
180+ it ( 'align should merge into placement' , async ( ) => {
181+ render (
182+ < Trigger
183+ popupVisible
184+ popup = { < span className = "bamboo" /> }
185+ builtinPlacements = { {
186+ top : {
187+ targetOffset : [ 0 , 0 ] ,
188+ } ,
189+ } }
190+ popupPlacement = "top"
191+ popupAlign = { {
192+ targetOffset : [ 903 , 1128 ] ,
193+ } }
194+ >
195+ < span />
196+ </ Trigger > ,
197+ ) ;
198+
199+ await awaitFakeTimer ( ) ;
200+
201+ expect (
202+ document . querySelector ( '.rc-trigger-popup-placement-top' ) ,
203+ ) . toHaveStyle ( {
204+ left : `753px` ,
205+ top : `978px` ,
206+ } ) ;
207+ } ) ;
179208} ) ;
You can’t perform that action at this time.
0 commit comments