Download react-boilerplate/app/components/Button/tests/StyledButton.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 918 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-boilerplate/app/components/Button/tests/StyledButton.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-boilerplate/app/components/Button/tests/StyledButton.test.js
-
curl -L -o StyledButton.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-boilerplate/app/components/Button/tests/StyledButton.test.js
918 Bytes
| import React from 'react'; | |
| import { render } from 'react-testing-library'; | |
| import StyledButton from '../StyledButton'; | |
| describe('<StyledButton />', () => { | |
| it('should render an <button> tag', () => { | |
| const { container } = render(<StyledButton />); | |
| expect(container.querySelector('button')).not.toBeNull(); | |
| }); | |
| it('should have a class attribute', () => { | |
| const { container } = render(<StyledButton />); | |
| expect(container.querySelector('button').hasAttribute('class')).toBe(true); | |
| }); | |
| it('should adopt a valid attribute', () => { | |
| const id = 'test'; | |
| const { container } = render(<StyledButton id={id} />); | |
| expect(container.querySelector('button').id).toEqual(id); | |
| }); | |
| it('should not adopt an invalid attribute', () => { | |
| const { container } = render(<StyledButton attribute="test" />); | |
| expect(container.querySelector('button[attribute="test"]')).toBeNull(); | |
| }); | |
| }); | |