mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-06-07 02:35:01 -04:00
21 lines
605 B
JavaScript
21 lines
605 B
JavaScript
/* eslint-env jest */
|
|
/* eslint-disable no-unused-vars */
|
|
|
|
import React from 'react';
|
|
import {render, fireEvent} from '@testing-library/react';
|
|
import Button from '../../../src/components/button/button.jsx';
|
|
|
|
describe('Button', () => {
|
|
test('triggers callback when clicked', () => {
|
|
const onClick = jest.fn();
|
|
const {getByText} = render(
|
|
<Button onClick={onClick}>
|
|
{'Button'}
|
|
</Button>
|
|
);
|
|
|
|
const buttonElement = getByText('Button');
|
|
fireEvent.click(buttonElement);
|
|
expect(onClick).toHaveBeenCalled();
|
|
});
|
|
});
|