File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export interface ProgressProps {
1212 gapDegree ?: number ;
1313 gapPosition ?: GapPositionType ;
1414 transition ?: string ;
15+ onClick ?: React . MouseEventHandler ;
1516}
1617
1718export type BaseStrokeColorType = string | Record < string , string > ;
Original file line number Diff line number Diff line change @@ -149,5 +149,20 @@ describe('Progress', () => {
149149 'stroke:' ,
150150 ) ;
151151 } ) ;
152+
153+ it ( 'should support ts onClick' , ( ) => {
154+ const onClick = jest . fn ( ) ;
155+ const wrapper = mount (
156+ < >
157+ < Circle onClick = { onClick } className = "circle-target" />
158+ < Line onClick = { onClick } className = "line-target" />
159+ </ > ,
160+ ) ;
161+
162+ wrapper . find ( '.circle-target' ) . at ( 0 ) . simulate ( 'click' ) ;
163+ expect ( onClick ) . toHaveBeenCalledTimes ( 1 ) ;
164+ wrapper . find ( '.line-target' ) . at ( 0 ) . simulate ( 'click' ) ;
165+ expect ( onClick ) . toHaveBeenCalledTimes ( 2 ) ;
166+ } ) ;
152167 } ) ;
153168} ) ;
You can’t perform that action at this time.
0 commit comments