-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Federico Babrauskas
committed
Oct 22, 2019
1 parent
d52ca0b
commit 75a8e26
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react' | ||
import { render, cleanup } from '@testing-library/react' | ||
|
||
import Clickable, { ClickableProps } from './index' | ||
import { AdaptProvider } from '../' | ||
import 'jest-styled-components' | ||
|
||
afterEach(cleanup) | ||
|
||
describe('Clickable component', () => { | ||
const renderComponent = (customProps?: ClickableProps) => | ||
render( | ||
<AdaptProvider> | ||
<Clickable {...customProps} /> | ||
</AdaptProvider> | ||
) | ||
|
||
it('should render without crashing', () => { | ||
const { container } = renderComponent() | ||
expect(container.firstChild).toBeDefined() | ||
}) | ||
|
||
it('should render with full styles', () => { | ||
const { container } = renderComponent({ full: true }) | ||
expect(container.firstChild).toHaveStyleRule('display', 'block') | ||
expect(container.firstChild).toHaveStyleRule('width', '100%') | ||
}) | ||
|
||
it('should render with disabled styles', () => { | ||
const { container } = renderComponent({ disabled: true }) | ||
expect(container.firstChild).toHaveStyleRule('cursor', 'not-allowed') | ||
}) | ||
}) |