Skip to content

Commit

Permalink
Update tests for Button, Pill, and Radio
Browse files Browse the repository at this point in the history
components
  • Loading branch information
cesargdm committed Nov 14, 2023
1 parent 5061f35 commit 021f4e8
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
14 changes: 9 additions & 5 deletions src/Button/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fireEvent, render, screen } from '@/__tests__/utils'

import { Button } from '.'

describe('<Button />', () => {
describe.concurrent('<Button />', () => {
test('renders correctly', () => {
const component = render(<Button />)

Expand All @@ -14,9 +14,9 @@ describe('<Button />', () => {
test('fires onClick', () => {
const handleClick = vi.fn()

const { rerender } = render(
<Button onClick={handleClick} title="click me" />,
)
const { rerender } = render(<Button onClick={handleClick}>Click me</Button>)

screen.debug()

fireEvent(
screen.getByText(/click me/i),
Expand All @@ -28,7 +28,11 @@ describe('<Button />', () => {

expect(handleClick).toHaveBeenCalledTimes(1)

rerender(<Button onClick={handleClick} title="click me" disabled />)
rerender(
<Button onClick={handleClick} disabled>
Click me
</Button>,
)

fireEvent(
screen.getByText(/click me/i),
Expand Down
4 changes: 2 additions & 2 deletions src/Button/__snapshots__/Button.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ exports[`<Button /> > renders correctly 1`] = `
"baseElement": <body>
<div>
<button
class="sc-bcPKhP husKdk sc-grXZZQ"
class="sc-bdfCDU bfwdij sc-gsTDqH"
type="button"
/>
</div>
</body>,
"container": <div>
<button
class="sc-bcPKhP husKdk sc-grXZZQ"
class="sc-bdfCDU bfwdij sc-gsTDqH"
type="button"
/>
</div>,
Expand Down
2 changes: 1 addition & 1 deletion src/Pill/Pill.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { render } from '@/__tests__/utils'

import { Pill } from '.'

describe('<Pill />', () => {
describe.concurrent('<Pill />', () => {
it('renders correctly', () => {
const tree = render(<Pill message="Think different" />)

Expand Down
4 changes: 2 additions & 2 deletions src/Pill/__snapshots__/Pill.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`<Pill /> > renders correctly 1`] = `
"baseElement": <body>
<div>
<div
class="sc-bcPKhP jaMeqb sc-dkjKgF"
class="sc-bdfCDU eEcawE sc-dlfmHC"
>
<p>
Think different
Expand All @@ -16,7 +16,7 @@ exports[`<Pill /> > renders correctly 1`] = `
</body>,
"container": <div>
<div
class="sc-bcPKhP jaMeqb sc-dkjKgF"
class="sc-bdfCDU eEcawE sc-dlfmHC"
>
<p>
Think different
Expand Down
2 changes: 1 addition & 1 deletion src/Radio/Radio.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Radio } from '.'

const TEST_ID = 'radio-input'

describe('<Radio />', () => {
describe.concurrent('<Radio />', () => {
it('renders correctly', () => {
const tree = render(
<Radio
Expand Down
4 changes: 2 additions & 2 deletions src/Radio/__snapshots__/Radio.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`<Radio /> > renders correctly 1`] = `
"baseElement": <body>
<div>
<label
class="sc-bcPKhP dueiAV sc-grXZZQ"
class="sc-bdfCDU fWDrC sc-gsTDqH"
data-testid="radio-label"
for="radio-value"
>
Expand All @@ -23,7 +23,7 @@ exports[`<Radio /> > renders correctly 1`] = `
</body>,
"container": <div>
<label
class="sc-bcPKhP dueiAV sc-grXZZQ"
class="sc-bdfCDU fWDrC sc-gsTDqH"
data-testid="radio-label"
for="radio-value"
>
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/Tag.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { render } from '@/__tests__/utils'

import { Tag } from '.'

describe('<Tag />', () => {
describe.concurrent('<Tag />', () => {
it('renders correctly', () => {
const tree = render(<Tag />)

Expand Down
4 changes: 2 additions & 2 deletions src/Tag/__snapshots__/Tag.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ exports[`<Tag /> > renders correctly 1`] = `
"baseElement": <body>
<div>
<span
class="sc-bcPKhP ehMdpF"
class="sc-bdfCDU gDbbFz"
/>
</div>
</body>,
"container": <div>
<span
class="sc-bcPKhP ehMdpF"
class="sc-bdfCDU gDbbFz"
/>
</div>,
"debug": [Function],
Expand Down

0 comments on commit 021f4e8

Please sign in to comment.