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

[Stepper] Fix support for no connectors #26874

Merged
merged 4 commits into from Jun 26, 2021

Conversation

varandasi
Copy link
Contributor

The purpose of this PR is to allow to set a null stepper connector in TS. It works in JS. Perhaps there's another way to acomplish this, please let me know..

@oliviertassinari oliviertassinari changed the title Allow null stepper connector [Stepper] Fix support for no connectors Jun 21, 2021
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: stepper This is the name of the generic UI component, not the React module! labels Jun 21, 2021
@oliviertassinari oliviertassinari deleted the branch mui:next June 22, 2021 00:28
@oliviertassinari oliviertassinari changed the base branch from foo to next June 22, 2021 00:35
@mui-pr-bot
Copy link

mui-pr-bot commented Jun 22, 2021

No bundle size changes (experimental)

Generated by 🚫 dangerJS against 7be4ae4

@oliviertassinari oliviertassinari force-pushed the fix/allow-null-stepper-connector branch from e91127e to c0192d0 Compare June 22, 2021 12:59
@oliviertassinari
Copy link
Member

I have rebased on HEAD and migrated the test to TypeScript to have types test coverage (we have a functional test case for this one):

https://github.com/mui-org/material-ui/blob/f1c64b50b4f2f2864254cc483e0a75acbbe46c23/packages/material-ui/src/Stepper/Stepper.test.js#L165

@eps1lon Quite interesting to find that one of the test cases was doing nothing (thanks to TypeScript) 😆. Here, the class name doesn't exist:

https://github.com/mui-org/material-ui/blob/f1c64b50b4f2f2864254cc483e0a75acbbe46c23/packages/material-ui/src/Stepper/Stepper.test.js#L250

@oliviertassinari oliviertassinari requested a review from a team June 22, 2021 13:02
Comment on lines 250 to 259
expect(steps[0]).not.to.have.class(stepClasses.active);
expect(steps[1]).not.to.have.class(stepClasses.active);
expect(steps[2]).not.to.have.class(stepClasses.active);
expect(steps[0]).to.have.class(stepIconClasses.active);
expect(steps[1]).to.have.class(stepIconClasses.active);
expect(steps[2]).not.to.have.class(stepIconClasses.active);
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a new test instead of changing an existing one. These are usually indiciative of breaking changes.

Copy link
Member

Choose a reason for hiding this comment

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

stepClasses.active === undefined so the assertion was a tautology.

Copy link
Member

Choose a reason for hiding this comment

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

Why would two icons have the active class when only one step is active?

Copy link
Member

Choose a reason for hiding this comment

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

The test case renders as:

Capture d’écran 2021-06-22 à 18 06 00

The first icon is active because activeStep default to 0, and the second one is active because of the extra prop.

Copy link
Member

Choose a reason for hiding this comment

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

We could remove the test too, not real preferences. My intent was to have the test file migrated to TS, and then, noticed this useless test. This is an attempt to make it meaningful.

Copy link
Member

@eps1lon eps1lon Jun 23, 2021

Choose a reason for hiding this comment

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

but only one step can be active. This is almost certainly either a bug or an inconsistent state that we should guard against. What you're showing is "completed".

Copy link
Member

Choose a reason for hiding this comment

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

OK, I think that we are going too off topic to the problem the PR is trying to solve. I will remove this dead test case, without adding a new one.

Copy link
Member

Choose a reason for hiding this comment

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

For context the initial test we added is identical to the new one I'm proposing #13188.

I would also ask to reconsider your perspective on the problem based on the reactions that the developers had on your past answers on this topic (#13147, #12948)

I personally do think that multiple active steps make sense. When the steps are small enough, the information can be displayed all at once.

Copy link
Member

@eps1lon eps1lon Jun 23, 2021

Choose a reason for hiding this comment

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

I would also ask to reconsider your perspective on the problem based on the reactions that the developers had on your past answers on this topic

Why would I do that?

I personally do think that multiple active steps make sense. When the steps are small enough, the information can be displayed all at once.

Then don't use a stepper. These have a very specific use case based on user research. You're defeating the purpose of a stepper by displaying multiple steps.

Copy link
Member

Choose a reason for hiding this comment

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

Are you OK with removing this test (#26874 (comment)) to resolve this thread?

Why would I do that?

My personal experience on coming back to older issues where I got downvotes by community developers has been that I usually missed something. I think that it's because the collective knowledge of the crowd is usually (there are exceptions) superior to individuals. The point I wanted to make is that it can be a signal for an opportunity to challenge his belief system/hypotheses/conclusions.

@oliviertassinari oliviertassinari merged commit 3327da2 into mui:next Jun 26, 2021
@oliviertassinari
Copy link
Member

@varandasi Thanks for the fix

@varandasi
Copy link
Contributor Author

@varandasi Thanks for the fix

Thank you for the great work. Material UI is awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: stepper This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants