-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(store-ui): Checkbox atom component #813
Conversation
✔️ Deploy Preview for storeui ready! 🔨 Explore the source changes: 520c767 🔍 Inspect the deploy log: https://app.netlify.com/sites/storeui/deploys/60e888d0b1bf7c000733081e 😎 Browse the preview: https://deploy-preview-813--storeui.netlify.app |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 520c767:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need a data attribute to state checked.
|
||
describe('Checkbox', () => { | ||
it('data-store-checkbox is present', () => { | ||
const { getByTestId } = render(<Checkbox testId="checkbox" />) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { getByTestId } = render(<Checkbox testId="checkbox" />) | |
const { getByTestId } = render(<Checkbox testId="store-checkbox" />) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing the testId, instead of using the default one, prevents break the test furthermore, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a point. Maybe really better pass the testid.
it('data-store-checkbox is present', () => { | ||
const { getByTestId } = render(<Checkbox testId="checkbox" />) | ||
|
||
expect(getByTestId('checkbox')).toHaveAttribute('data-store-checkbox') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(getByTestId('checkbox')).toHaveAttribute('data-store-checkbox') | |
expect(getByTestId('store-checkbox')).toHaveAttribute('data-store-checkbox') |
}) | ||
|
||
it('type checkbox is present', () => { | ||
const { getByTestId } = render(<Checkbox testId="checkbox" />) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { getByTestId } = render(<Checkbox testId="checkbox" />) | |
const { getByTestId } = render(<Checkbox testId="store-checkbox" />) |
it('type checkbox is present', () => { | ||
const { getByTestId } = render(<Checkbox testId="checkbox" />) | ||
|
||
expect(getByTestId('checkbox')).toHaveAttribute('type', 'checkbox') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(getByTestId('checkbox')).toHaveAttribute('type', 'checkbox') | |
expect(getByTestId('store-checkbox')).toHaveAttribute('type', 'checkbox') |
But the CSS already has it |
664bcf2
to
5a3a164
Compare
@tlgimenes and @emersonlaurentino I did your request changes. |
@igorbrasileiro the tip of @tlgimenes is great! |
If I understood well, it's to create a control for checked property and an action for the click event, I did it also. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this pull request?
Add the Checkbox atom to store-ui
How it works?
How to test it?
References