Skip to content

Commit

Permalink
Update test for NaN value in DOMComponent and add CSSPropOp test
Browse files Browse the repository at this point in the history
  • Loading branch information
jontewks committed Jan 16, 2016
1 parent 59d5d01 commit 7481db4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/renderers/dom/shared/__tests__/CSSPropertyOperations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,17 @@ describe('CSSPropertyOperations', function() {
expect(console.error.argsForCall[0][0]).toContain('Try "backgroundColor: blue" instead');
expect(console.error.argsForCall[1][0]).toContain('Try "color: red" instead');
});

it('should warn about style containing a NaN value', function() {
spyOn(console, 'error');

CSSPropertyOperations.createMarkupForStyles({
fontSize: NaN,
});

expect(console.error.calls.length).toBe(1);
expect(console.error.argsForCall[0][0]).toEqual(
'Warning: `NaN` is an invalid value for the `fontSize` css style property'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ describe('ReactDOMComponent', function() {
ReactDOM.render(<span style={style}></span>, div);
ReactDOM.render(<span style={style}></span>, div);

expect(console.error.argsForCall.length).toBe(1);
expect(console.error.argsForCall.length).toBe(2);
expect(console.error.argsForCall[0][0]).toEqual(
'Warning: `NaN` is an invalid value for the `fontSize` css style property'
);
Expand Down

0 comments on commit 7481db4

Please sign in to comment.