File tree Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export interface ArrowProps {
12
12
export default function Arrow ( props : ArrowProps ) {
13
13
const { prefixCls, align, arrow, arrowPos } = props ;
14
14
15
- const { className, content } = arrow || { } ;
15
+ const { className, content, style } = arrow || { } ;
16
16
const { x = 0 , y = 0 } = arrowPos ;
17
17
18
18
const arrowRef = React . useRef < HTMLDivElement > ( null ) ;
@@ -58,7 +58,7 @@ export default function Arrow(props: ArrowProps) {
58
58
< div
59
59
ref = { arrowRef }
60
60
className = { classNames ( `${ prefixCls } -arrow` , className ) }
61
- style = { alignStyle }
61
+ style = { { ... alignStyle , ... style } }
62
62
>
63
63
{ content }
64
64
</ div >
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ export interface AlignType {
89
89
}
90
90
91
91
export interface ArrowTypeOuter {
92
+ style ?: React . CSSProperties ;
92
93
className ?: string ;
93
94
content ?: React . ReactNode ;
94
95
}
Original file line number Diff line number Diff line change @@ -188,6 +188,66 @@ describe('Trigger.Arrow', () => {
188
188
const arrowDom = document . querySelector ( '.rc-trigger-popup-arrow' ) ;
189
189
expect ( arrowDom . classList . contains ( 'abc' ) ) . toBeTruthy ( ) ;
190
190
} ) ;
191
+
192
+ it ( 'arrow style' , async ( ) => {
193
+ render (
194
+ < Trigger
195
+ popupVisible
196
+ popupAlign = { {
197
+ points : [ 'cl' , 'cr' ] ,
198
+ autoArrow : false ,
199
+ } }
200
+ popup = { < strong > trigger</ strong > }
201
+ arrow = { {
202
+ style : {
203
+ color : 'red' ,
204
+ backgroundColor : 'blue' ,
205
+ } ,
206
+ } }
207
+ >
208
+ < div />
209
+ </ Trigger > ,
210
+ ) ;
211
+
212
+ await awaitFakeTimer ( ) ;
213
+
214
+ const arrowDom = document . querySelector ( '.rc-trigger-popup-arrow' ) ;
215
+ expect ( arrowDom ) . toHaveStyle ( {
216
+ color : 'red' ,
217
+ backgroundColor : 'blue' ,
218
+ } ) ;
219
+ } ) ;
220
+
221
+ it ( 'arrow style should merge with align style' , async ( ) => {
222
+ render (
223
+ < Trigger
224
+ popupVisible
225
+ popupAlign = { {
226
+ points : [ 'cl' , 'cr' ] ,
227
+ autoArrow : true ,
228
+ } }
229
+ popup = { < strong > trigger</ strong > }
230
+ arrow = { {
231
+ style : {
232
+ color : 'red' ,
233
+ backgroundColor : 'blue' ,
234
+ } ,
235
+ } }
236
+ >
237
+ < div />
238
+ </ Trigger > ,
239
+ ) ;
240
+
241
+ await awaitFakeTimer ( ) ;
242
+
243
+ const arrowDom = document . querySelector ( '.rc-trigger-popup-arrow' ) ;
244
+ // Should have both align style (left: 0) and custom style
245
+ expect ( arrowDom ) . toHaveStyle ( {
246
+ left : 0 ,
247
+ color : 'red' ,
248
+ backgroundColor : 'blue' ,
249
+ } ) ;
250
+ } ) ;
191
251
} ) ;
192
252
193
253
it ( 'content' , async ( ) => {
You can’t perform that action at this time.
0 commit comments