update to use spyOn for console.warn #2749

This commit is contained in:
Kevin Old
2015-01-26 21:51:42 -06:00
parent c6d1904f24
commit f0ea2b5979
7 changed files with 157 additions and 224 deletions
+5 -11
View File
@@ -82,6 +82,8 @@ describe('cloneWithProps', function() {
});
it('should warn when cloning with refs', function() {
spyOn(console, 'warn');
var Grandparent = React.createClass({
render: function() {
return <Parent><div ref="yolo" /></Parent>;
@@ -97,17 +99,9 @@ describe('cloneWithProps', function() {
}
});
var _warn = console.warn;
try {
console.warn = mocks.getMockFunction();
var component = ReactTestUtils.renderIntoDocument(<Grandparent />);
expect(component.refs).toBe(emptyObject);
expect(console.warn.mock.calls.length).toBe(1);
} finally {
console.warn = _warn;
}
var component = ReactTestUtils.renderIntoDocument(<Grandparent />);
expect(component.refs).toBe(emptyObject);
expect(console.warn.argsForCall.length).toBe(1);
});
it('should transfer the key property', function() {