Skip to content

Commit

Permalink
adicionando testes para mudanca de tamanho
Browse files Browse the repository at this point in the history
  • Loading branch information
davimattos committed Jan 30, 2021
1 parent d571d3e commit e4d4e62
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/components/Button/test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { screen } from '@testing-library/react'
import { renderWithTheme } from 'utils/tests/helpers'

import Button from '.'

describe('<Button />', () => {
it('should render a medium size by default', () => {
renderWithTheme(<Button>Click Me</Button>)
expect(screen.getByRole('button', { name: /Click Me/i })).toHaveStyle({
height: '4rem',
padding: '0.8rem 3.2rem',
'font-size': '1.4rem'
})
})

it('should render a large size when props is passed', () => {
renderWithTheme(<Button size="large">Click Me</Button>)
expect(screen.getByRole('button', { name: /Click Me/i })).toHaveStyle({
height: '5rem',
padding: '0.8rem 4.8rem',
'font-size': '1.6rem'
})
})

it('should render a small size when props is passed', () => {
renderWithTheme(<Button size="small">Click Me</Button>)
expect(screen.getByRole('button', { name: /Click Me/i })).toHaveStyle({
height: '3rem',
padding: '0.8rem',
'font-size': '1.2rem'
})
})
})

0 comments on commit e4d4e62

Please sign in to comment.