Skip to content

Commit

Permalink
Make correct output for number children in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
roadhump committed Jan 29, 2016
1 parent a2ffa51 commit 801bf42
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function propsString(node) {

export function debugNode(node, indentLength = 2) {
if (!node) return '';
if (typeof node === 'string') return escape(node);
if (typeof node === 'string' || typeof node === 'number') return escape(node);

const children = compact(childrenOfNode(node).map(n => debugNode(n, indentLength)));
const type = typeName(node);
Expand Down
12 changes: 12 additions & 0 deletions src/__tests__/Debug-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ describe('debug', () => {
);
});

it('should render mapped number children properly', () => {
expect(debugNode(
<div>
{777}
</div>
)).to.equal(
`<div>
777
</div>`
);
});

it('renders html entities properly', () => {
expect(debugNode(
<div>&gt;</div>
Expand Down

0 comments on commit 801bf42

Please sign in to comment.