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

undefined Link classNames after upgrading 2.0 -> 2.2 #3322

Closed
sprzybylski opened this issue Apr 15, 2016 · 3 comments
Closed

undefined Link classNames after upgrading 2.0 -> 2.2 #3322

sprzybylski opened this issue Apr 15, 2016 · 3 comments

Comments

@sprzybylski
Copy link

My tests started to fail after upgrading to 2.2, what was unexpected bumping just minor version.
I was expecting every Link component to have className props.

Should we update upgrade guide for 2.2 or this should be considered a bug?

const links = TestUtils.scryRenderedComponentsWithType(component, Link);
links.map((link) => link.props.className)

2.0.1 outputs:
[ '', 'a-class-name' ]
2.2.2 outputs:
[ undefined, 'a-class-name' ]

@ryanflorence
Copy link
Member

ryanflorence commented Apr 15, 2016

Sorry it broke your tests. Rendering w/ empty classNames was a bug so we don't consider it a breaking change.

We could add a note in the upgrade guide that tests that are that specific may break.

#3288

@sprzybylski
Copy link
Author

Thanks!
Want me to make a PR with the note?
Below part of test case for my pagination component that failed after upgrading.

const links = TestUtils.scryRenderedComponentsWithType(component, Link);
const previous = links.find((link) => link.props.className.match('previous'));
previous.props.to.should.equal(correctPath);

@taion
Copy link
Contributor

taion commented Apr 18, 2016

@sprzybylski That's a generally not-recommended pattern for testing classes. You should be asserting on the actual rendered classes, not props.className.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants