Skip to content

Conversation

luizbaldi
Copy link
Member

Create an initial test structure using jest and @testing-library/react with initial tests for the components:

  • Anchor
  • AppBar
  • Avatar
  • Bar
  • Button
  • Cutout

Obs: This is related to #27

const { container, rerender } = render(<Bar size='sm' />)
const barEl = container.firstChild

expect(barEl).toHaveStyleRule('height', '27px')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree with u! Fixed :)

expect(onButtonClick).toHaveBeenCalled()
})

it('should render disabled', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we should also test other variants of <Button /> . That's because variant="menu" and variant="flat" also have the disabled option. Below links to the Storybook where you can see both variants in disabled and not disabled state:
variant="menu"
variant="flat"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, added more test cases for different variants :)

expect(button).toHaveAttribute('type', 'submit')
})

it('should handle click properly', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also test if the button with disabled prop reacts to onClick (when button is disabled it doesn't trigger specified onClick prop when clicked).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well-observed, thanks!

fixed :)

- Improve Bar tests with blockSizes from commom instead of static values
- Test disabled Button callback function
@arturbien arturbien merged commit 4754a82 into react95-io:master Jul 23, 2019
@arturbien
Copy link
Member

🎉 This PR is included in version 3.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@arturbien
Copy link
Member

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants