Skip to content
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

Update Profile TrackSwitcher Icon onChange #830

Merged
merged 2 commits into from
Apr 26, 2021

Conversation

neenjaw
Copy link
Collaborator

@neenjaw neenjaw commented Apr 25, 2021

Previous to this patch, the track switcher on the profile page did not update the icon based on the track:

Screenshot from 2021-04-24 18-57-48

With this patch, it updates when the value changes (1 line fix)

Screenshot from 2021-04-24 18-58-04

@iHiD
Copy link
Member

iHiD commented Apr 25, 2021

@neenjaw Thanks! Want to throw a test in for it?

track switcher implementation not tested in depth because previously covered by `useDropdown.test.js`
{
files: ['*.test.ts', '*.test.tsx'],
rules: {
'@typescript-eslint/no-empty-function': 'off',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is sometimes easy to use an empty function for testing without creating a complex requirement

files: ['*.test.ts', '*.test.tsx'],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': 'off',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just my opnion here but in test files I don't think this matters too much. Maybe downgrading it to a warning rather than an error?

{
files: ['*.ts', '*.tsx'],
rules: {
'react/prop-types': 'off',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

prop-types aren't used in typescript. I think this is raising an error just because we have a mix of js and ts in the project

@iHiD
Copy link
Member

iHiD commented Apr 25, 2021

@neenjaw Thanks!
@kntsoriano Could you review pls? :)

Copy link
Contributor

@kntsoriano kntsoriano left a comment

Choose a reason for hiding this comment

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

Looks good!

const button = screen.getByLabelText('Open the track switcher')

await act(async () => {
await fireEvent.click(button)
Copy link
Contributor

Choose a reason for hiding this comment

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

I usually use userEvent.click instead of fireEvent.click. Is there any advantage to use fireEvent instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I use fireEvent because that's what I know, but looking for a reference to think points out that using userEvent might be a better way to go about this. Reference: testing-library/eslint-plugin-testing-library#162 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

@neenjaw Want to change or should I merge? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are essentially the same thing, so this works and covers it, but if I'm in this piece of code again I would change it. I think good to merge

@@ -0,0 +1,66 @@
import { RepresenterFeedback } from '../../../app/javascript/components/mentoring/session/RepresenterFeedback'
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice :) I should do something like this from now on.

@iHiD iHiD merged commit b2925fd into exercism:main Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants