We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 23bfdce commit de64674Copy full SHA for de64674
src/components/button/__tests__/Button.test.js
@@ -135,4 +135,18 @@ describe('Button', () => {
135
await user.click(button.getByText('Clickable'));
136
expect(mockEventListener.mock.calls).toHaveLength(0);
137
});
138
+
139
+ test('onClick can be overridden', async () => {
140
+ const user = userEvent.setup();
141
+ const mockOnClick = jest.fn();
142
+ const button = render(
143
+ <Button href="/relative" onClick={mockOnClick}>
144
+ Clickable
145
+ </Button>
146
+ );
147
148
+ expect(mockOnClick.mock.calls).toHaveLength(0);
149
+ await user.click(button.getByText('Clickable'));
150
+ expect(mockOnClick.mock.calls).toHaveLength(1);
151
+ });
152
0 commit comments