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

Newline immediately following class causes '.classname' selector to fail #347

Closed
GabeIsman opened this issue Apr 25, 2016 · 6 comments
Closed

Comments

@GabeIsman
Copy link

This should be approximately the minimal test case. Apologies for not writing an actual failing test.
Component:

<TestComponent className={`some-class
`} />

Test:

expect(shallow(<TestComponent />).is('.some-class')).to.be.true(); // Actually false

Tested with version 2.2.0.

@ljharb
Copy link
Member

ljharb commented Apr 25, 2016

Does the same happen if you have a trailing space on the class name?

@GabeIsman
Copy link
Author

@ljharb Nope. Just a new line from what I've seen.

@ljharb
Copy link
Member

ljharb commented Apr 25, 2016

@GabeIsman thanks! does it also occur on mount?

@GabeIsman
Copy link
Author

@ljharb Yep!

@aweary
Copy link
Collaborator

aweary commented Apr 26, 2016

@ljharb would it work if we just stripped any trailing newline characters (or maybe all non-signiciant whitespace?) in instHasClassName? Just calling trim on the className before comparing it might be enough.

Some goes for hasClassName.

@GabeIsman
Copy link
Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants