Skip to content

Commit

Permalink
Silence console.error in ReactDOMInput-test
Browse files Browse the repository at this point in the history
This test is expected to throw but because of ReactErrorUtils.guard
which uses console.error in __DEV__ it also logged the invariant error
to the console. This change fixes it by temporarily stubbing out
console.error.

Fixes facebook#531
  • Loading branch information
cpojer authored and zpao committed Jan 6, 2014
1 parent e65726c commit 22ba8b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dom/components/__tests__/ReactDOMInput-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ describe('ReactDOMInput', function() {
});

it('should throw if both value and valueLink are provided', function() {
// Silences console.error messages
// ReactErrorUtils.guard is applied to all methods of a React component
// and calls console.error in __DEV__ (true for test environment)
spyOn(console, 'error');

var node = document.createElement('div');
var link = new ReactLink('yolo', mocks.getMockFunction());
var instance = <input type="text" valueLink={link} />;
Expand Down

0 comments on commit 22ba8b6

Please sign in to comment.