import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary'; import Button from 'sentry/components/button'; describe('Button', function () { it('renders', function () { const {container} = render(); expect(container).toSnapshot(); }); it('renders react-router link', function () { const {container} = render(); expect(container).toSnapshot(); }); it('renders normal link', function () { const {container} = render(); expect(container).toSnapshot(); }); it('renders disabled normal link', function () { const {container} = render(); expect(container).toSnapshot(); }); it('calls `onClick` callback', function () { const spy = jest.fn(); render(); userEvent.click(screen.getByText('Click me')); expect(spy).toHaveBeenCalled(); }); it('does not call `onClick` on disabled buttons', function () { const spy = jest.fn(); render( ); userEvent.click(screen.getByText('Click me')); expect(spy).not.toHaveBeenCalled(); }); });