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(
128
128
const win = getWin ( popupElement ) ;
129
129
130
130
// Placement
131
- const placementInfo : AlignType =
132
- builtinPlacements [ placement ] || popupAlign || { } ;
131
+ const placementInfo : AlignType = {
132
+ ...builtinPlacements [ placement ] ,
133
+ ...popupAlign ,
134
+ } ;
133
135
134
136
// Reset first
135
137
popupElement . style . left = '0' ;
Original file line number Diff line number Diff line change @@ -176,4 +176,33 @@ describe('Trigger.Align', () => {
176
176
await awaitFakeTimer ( ) ;
177
177
expect ( onPopupAlign ) . not . toHaveBeenCalled ( ) ;
178
178
} ) ;
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
+ } ) ;
179
208
} ) ;
You can’t perform that action at this time.
0 commit comments