diff options
author | Renaud Chaput <renchap@gmail.com> | 2023-02-20 03:20:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 03:20:59 +0100 |
commit | 44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 (patch) | |
tree | 71b60ccd9b23ec8f8d72fa3562f0bc343c6e456e /app/javascript/mastodon/components/__tests__/button-test.js | |
parent | f0e1b12c101e0dd0ddaaef8bdcc166624dba62d5 (diff) |
Rename JSX files with proper `.jsx` extension (#23733)
Diffstat (limited to 'app/javascript/mastodon/components/__tests__/button-test.js')
-rw-r--r-- | app/javascript/mastodon/components/__tests__/button-test.js | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/app/javascript/mastodon/components/__tests__/button-test.js b/app/javascript/mastodon/components/__tests__/button-test.js deleted file mode 100644 index f5a649f70..000000000 --- a/app/javascript/mastodon/components/__tests__/button-test.js +++ /dev/null @@ -1,75 +0,0 @@ -import { render, fireEvent, screen } from '@testing-library/react'; -import React from 'react'; -import renderer from 'react-test-renderer'; -import Button from '../button'; - -describe('<Button />', () => { - it('renders a button element', () => { - const component = renderer.create(<Button />); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('renders the given text', () => { - const text = 'foo'; - const component = renderer.create(<Button text={text} />); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('handles click events using the given handler', () => { - const handler = jest.fn(); - render(<Button onClick={handler}>button</Button>); - fireEvent.click(screen.getByText('button')); - - expect(handler.mock.calls.length).toEqual(1); - }); - - it('does not handle click events if props.disabled given', () => { - const handler = jest.fn(); - render(<Button onClick={handler} disabled>button</Button>); - fireEvent.click(screen.getByText('button')); - - expect(handler.mock.calls.length).toEqual(0); - }); - - it('renders a disabled attribute if props.disabled given', () => { - const component = renderer.create(<Button disabled />); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('renders the children', () => { - const children = <p>children</p>; - const component = renderer.create(<Button>{children}</Button>); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('renders the props.text instead of children', () => { - const text = 'foo'; - const children = <p>children</p>; - const component = renderer.create(<Button text={text}>{children}</Button>); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('renders class="button--block" if props.block given', () => { - const component = renderer.create(<Button block />); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); - - it('adds class "button-secondary" if props.secondary given', () => { - const component = renderer.create(<Button secondary />); - const tree = component.toJSON(); - - expect(tree).toMatchSnapshot(); - }); -}); |