Skip to content

Commit b690ec3

Browse files
authored
feat: add onClick prop (#129)
1 parent 070dce6 commit b690ec3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface ProgressProps {
1212
gapDegree?: number;
1313
gapPosition?: GapPositionType;
1414
transition?: string;
15+
onClick?: React.MouseEventHandler;
1516
}
1617

1718
export type BaseStrokeColorType = string | Record<string, string>;

tests/index.spec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)