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

Change ShallowWrapper.text() trim spaces with same behavior as ReactWrapper.text() #1350

Merged
merged 3 commits into from
Nov 14, 2017

Conversation

idanilt
Copy link
Contributor

@idanilt idanilt commented Nov 12, 2017

ReactWrapper.text() return string with the spaces as is, ShallowWrapper.text() removing double spaces and replacing   with regular space (removing doubles as well).

Fixes #1349.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

LGTM overall

@@ -1633,6 +1633,29 @@ describe('shallow', () => {
matchesRender(<div>&gt;</div>);
});

it('should handle spaces with same behavior as ReactWarpper.text()', () => {
Copy link
Member

Choose a reason for hiding this comment

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

ReactWarpper.textReactWrapper.text

@idanilt
Copy link
Contributor Author

idanilt commented Nov 13, 2017

In the end ReactWrapper.text() don't do anything to spaces, so the solution was to remove the replace at all.
I added a fix for npm run react:n for Windows machines

@ljharb
Copy link
Member

ljharb commented Nov 13, 2017

@idanilt would you mind rebasing this on latest master?

Idan Levin added 3 commits November 14, 2017 15:11
…rapper.text()

- remove empty nodes
- remove double spaces
- remove spaces from beginning or end
- not sure all those are all the rule, need to check
- couldn't run tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants