Skip to content

Commit

Permalink
fixed typo; remove replace spaces (ReactWrapper.text() not removing a…
Browse files Browse the repository at this point in the history
…ny spaces); fix env on Windows;
  • Loading branch information
Idan Levin committed Nov 13, 2017
1 parent 361d697 commit 343b112
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion env.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Promise.resolve()
const peerDeps = adapterJson.peerDependencies;
const installs = Object.keys(peerDeps)
.filter(key => !key.startsWith('enzyme'))
.map(key => `${key}@'${peerDeps[key]}'`)
.map(key => `${key}@"${peerDeps[key]}"`)
.join(' ');

testJson.dependencies[adapterName] = adapterJson.version;
Expand Down
8 changes: 5 additions & 3 deletions packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1633,17 +1633,19 @@ describe('shallow', () => {
matchesRender(<div>&gt;</div>);
});

it('should handle spaces with same behavior as ReactWarpper.text()', () => {
it('should handle spaces with same behavior as ReactWrapper.text()', () => {
const Space = (
<div>
<div> test </div>
<div>Hello


World</div>
World
</div>
<div>Hello World</div>
<div>Hello
World</div>
World
</div>
<div>Hello World</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;</div>
Expand Down
5 changes: 1 addition & 4 deletions packages/enzyme/src/RSTTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,5 @@ export function getTextFromNode(node) {
}

return childrenOfNode(node).map(getTextFromNode)
.join('')
.replace(/^[ \t\n\r]+$/g, '') // remove empty nodes
.replace(/[ \t\n\r]+/, ' ') // remove double spaces
.replace(/(^[ \t\n\r]*|[ \t\n\r]*$)/, ''); // remove spaces from beginning or end
.join('');
}

0 comments on commit 343b112

Please sign in to comment.