-
Notifications
You must be signed in to change notification settings - Fork 699
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
tests: Add tests for some components #11910
Conversation
Build Artifacts
|
test('renders correctly with label placeholder and options', async () => { | ||
renderComponent(); | ||
|
||
expect(screen.getByText('Gender')).toBeInTheDocument(); |
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 could use getByLabel, to diferentiate that this is the label of the input. And we can add an array of options that it should contain.
Also, the component is responsible for emitting events when a selected value changes, which could be another test case.
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.
Using getByLabelText
does not work for this particular component. I suspect it's due to the markup that's surrounding it.
<div class="ui-select-label-text is-inline">
Gender
</div>
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.
Thanks @EshaanAgg. Code looks good to me :) will let the final approve to @MisRob.
Ah I'm sorry, I assigned myself in hopes I would use this opportunity to learn more but I don't think I will get to it this week. Thanks for review @AlexVelezLl |
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.
Thanks @EshaanAgg
Summary
TotalPoints
GenderDisplayText
GenderSelect
I am not testing the user interaction in the case of the
GenderSelect
component, as we are using a pre-defined component from the Kolibri library, and thus, it should be the duty of theKDS
package to test the UI interactions and then export the components.Testing checklist
PR process
Reviewer checklist
yarn
andpip
)