diff --git a/src/addons/__tests__/ReactFragment-test.js b/src/addons/__tests__/ReactFragment-test.js index f0f3297c75..ee04edce3c 100644 --- a/src/addons/__tests__/ReactFragment-test.js +++ b/src/addons/__tests__/ReactFragment-test.js @@ -86,7 +86,7 @@ describe('ReactFragment', function() { spyOn(console, 'error'); ReactFragment.create(null); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'React.addons.createFragment only accepts a single object.' ); }); @@ -95,7 +95,7 @@ describe('ReactFragment', function() { spyOn(console, 'error'); ReactFragment.create([]); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'React.addons.createFragment only accepts a single object.' ); }); @@ -104,7 +104,7 @@ describe('ReactFragment', function() { spyOn(console, 'error'); ReactFragment.create(
); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'React.addons.createFragment does not accept a ReactElement without a ' + 'wrapper object.' ); diff --git a/src/isomorphic/classic/class/__tests__/ReactClass-test.js b/src/isomorphic/classic/class/__tests__/ReactClass-test.js index 3a5b99f398..8a3f6f59a7 100644 --- a/src/isomorphic/classic/class/__tests__/ReactClass-test.js +++ b/src/isomorphic/classic/class/__tests__/ReactClass-test.js @@ -379,7 +379,7 @@ describe('ReactClass-spec', function() { instance.getDOMNode(); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'MyComponent.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.' ); diff --git a/src/isomorphic/classic/element/__tests__/ReactElementClone-test.js b/src/isomorphic/classic/element/__tests__/ReactElementClone-test.js index 9a6774409b..952e5eb243 100644 --- a/src/isomorphic/classic/element/__tests__/ReactElementClone-test.js +++ b/src/isomorphic/classic/element/__tests__/ReactElementClone-test.js @@ -258,7 +258,7 @@ describe('ReactElementClone', function() { }); ReactTestUtils.renderIntoDocument(React.createElement(GrandParent)); expect(console.error.argsForCall.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Invalid prop `color` of type `number` supplied to `Component`, ' + 'expected `string`. Check the render method of `Parent`.' diff --git a/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js b/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js index 089533d971..12621e359f 100644 --- a/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js +++ b/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js @@ -239,7 +239,7 @@ describe('ReactElementValidator', function() { }, }); ReactTestUtils.renderIntoDocument(React.createElement(ParentComp)); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Invalid prop `color` of type `number` supplied to `MyComp`, ' + 'expected `string`. Check the render method of `ParentComp`.' @@ -253,22 +253,22 @@ describe('ReactElementValidator', function() { React.createElement(true); React.createElement(123); expect(console.error.calls.length).toBe(4); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: React.createElement: type should not be null, undefined, ' + 'boolean, or number. It should be a string (for DOM elements) or a ' + 'ReactClass (for composite components).' ); - expect(console.error.calls[1].args[0]).toBe( + expect(console.error.argsForCall[1][0]).toBe( 'Warning: React.createElement: type should not be null, undefined, ' + 'boolean, or number. It should be a string (for DOM elements) or a ' + 'ReactClass (for composite components).' ); - expect(console.error.calls[2].args[0]).toBe( + expect(console.error.argsForCall[2][0]).toBe( 'Warning: React.createElement: type should not be null, undefined, ' + 'boolean, or number. It should be a string (for DOM elements) or a ' + 'ReactClass (for composite components).' ); - expect(console.error.calls[3].args[0]).toBe( + expect(console.error.argsForCall[3][0]).toBe( 'Warning: React.createElement: type should not be null, undefined, ' + 'boolean, or number. It should be a string (for DOM elements) or a ' + 'ReactClass (for composite components).' @@ -292,7 +292,7 @@ describe('ReactElementValidator', function() { 'but got: null. Check the render method of `ParentComp`.' ); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: React.createElement: type should not be null, undefined, ' + 'boolean, or number. It should be a string (for DOM elements) or a ' + 'ReactClass (for composite components). Check the render method of ' + @@ -316,7 +316,7 @@ describe('ReactElementValidator', function() { ReactTestUtils.renderIntoDocument(React.createElement(Component)); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Required prop `prop` was not specified in `Component`.' ); @@ -340,7 +340,7 @@ describe('ReactElementValidator', function() { ); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Required prop `prop` was not specified in `Component`.' ); @@ -366,12 +366,12 @@ describe('ReactElementValidator', function() { ); expect(console.error.calls.length).toBe(2); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Required prop `prop` was not specified in `Component`.' ); - expect(console.error.calls[1].args[0]).toBe( + expect(console.error.argsForCall[1][0]).toBe( 'Warning: Failed propType: ' + 'Invalid prop `prop` of type `number` supplied to ' + '`Component`, expected `string`.' @@ -402,7 +402,7 @@ describe('ReactElementValidator', function() { ); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Component: type specification of prop `myProp` is invalid; ' + 'the type checker function must return `null` or an `Error` but ' + 'returned a function. You may have forgotten to pass an argument to ' + diff --git a/src/isomorphic/modern/class/__tests__/ReactCoffeeScriptClass-test.coffee b/src/isomorphic/modern/class/__tests__/ReactCoffeeScriptClass-test.coffee index e0775a3cc0..0aa70fac12 100644 --- a/src/isomorphic/modern/class/__tests__/ReactCoffeeScriptClass-test.coffee +++ b/src/isomorphic/modern/class/__tests__/ReactCoffeeScriptClass-test.coffee @@ -52,7 +52,7 @@ describe 'ReactCoffeeScriptClass', -> ReactDOM.render React.createElement(Foo), container ).toThrow() expect(console.error.calls.length).toBe(1) - expect(console.error.calls[0].args[0]).toContain('No `render` method found on the returned component instance') + expect(console.error.argsForCall[0][0]).toContain('No `render` method found on the returned component instance') it 'renders a simple stateless component with prop', -> class Foo extends React.Component @@ -293,16 +293,16 @@ describe 'ReactCoffeeScriptClass', -> expect(getInitialStateWasCalled).toBe false expect(getDefaultPropsWasCalled).toBe false expect(console.error.calls.length).toBe 4 - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'getInitialState was defined on Foo, a plain JavaScript class.' ) - expect(console.error.calls[1].args[0]).toContain( + expect(console.error.argsForCall[1][0]).toContain( 'getDefaultProps was defined on Foo, a plain JavaScript class.' ) - expect(console.error.calls[2].args[0]).toContain( + expect(console.error.argsForCall[2][0]).toContain( 'propTypes was defined as an instance property on Foo.' ) - expect(console.error.calls[3].args[0]).toContain( + expect(console.error.argsForCall[3][0]).toContain( 'contextTypes was defined as an instance property on Foo.' ) @@ -318,7 +318,7 @@ describe 'ReactCoffeeScriptClass', -> test React.createElement(NamedComponent), 'SPAN', 'foo' expect(console.error.calls.length).toBe 1 - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: NamedComponent has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.' @@ -336,7 +336,7 @@ describe 'ReactCoffeeScriptClass', -> test React.createElement(NamedComponent), 'SPAN', 'foo' expect(console.error.calls.length).toBe 1 - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: NamedComponent has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?' ) @@ -351,19 +351,19 @@ describe 'ReactCoffeeScriptClass', -> expect(-> instance.setProps name: 'bar').toThrow() expect(-> instance.replaceProps name: 'bar').toThrow() expect(console.error.calls.length).toBe 5 - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'getDOMNode(...) is deprecated in plain JavaScript React classes' ) - expect(console.error.calls[1].args[0]).toContain( + expect(console.error.argsForCall[1][0]).toContain( 'replaceState(...) is deprecated in plain JavaScript React classes' ) - expect(console.error.calls[2].args[0]).toContain( + expect(console.error.argsForCall[2][0]).toContain( 'isMounted(...) is deprecated in plain JavaScript React classes' ) - expect(console.error.calls[3].args[0]).toContain( + expect(console.error.argsForCall[3][0]).toContain( 'setProps(...) is deprecated in plain JavaScript React classes' ) - expect(console.error.calls[4].args[0]).toContain( + expect(console.error.argsForCall[4][0]).toContain( 'replaceProps(...) is deprecated in plain JavaScript React classes' ) diff --git a/src/isomorphic/modern/class/__tests__/ReactES6Class-test.js b/src/isomorphic/modern/class/__tests__/ReactES6Class-test.js index fea1385fcf..c875c6b202 100644 --- a/src/isomorphic/modern/class/__tests__/ReactES6Class-test.js +++ b/src/isomorphic/modern/class/__tests__/ReactES6Class-test.js @@ -62,7 +62,7 @@ describe('ReactES6Class', function() { expect(() => ReactDOM.render(, container)).toThrow(); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Foo(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an element ' + @@ -343,16 +343,16 @@ describe('ReactES6Class', function() { expect(getInitialStateWasCalled).toBe(false); expect(getDefaultPropsWasCalled).toBe(false); expect(console.error.calls.length).toBe(4); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'getInitialState was defined on Foo, a plain JavaScript class.' ); - expect(console.error.calls[1].args[0]).toContain( + expect(console.error.argsForCall[1][0]).toContain( 'getDefaultProps was defined on Foo, a plain JavaScript class.' ); - expect(console.error.calls[2].args[0]).toContain( + expect(console.error.argsForCall[2][0]).toContain( 'propTypes was defined as an instance property on Foo.' ); - expect(console.error.calls[3].args[0]).toContain( + expect(console.error.argsForCall[3][0]).toContain( 'contextTypes was defined as an instance property on Foo.' ); }); @@ -371,7 +371,7 @@ describe('ReactES6Class', function() { test(, 'SPAN', 'foo'); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: ' + 'NamedComponent has a method called componentShouldUpdate(). Did you ' + 'mean shouldComponentUpdate()? The name is phrased as a question ' + @@ -393,7 +393,7 @@ describe('ReactES6Class', function() { test(, 'SPAN', 'foo'); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: ' + 'NamedComponent has a method called componentWillRecieveProps(). Did ' + 'you mean componentWillReceiveProps()?' @@ -409,20 +409,20 @@ describe('ReactES6Class', function() { expect(() => instance.setProps({name: 'bar'})).toThrow(); expect(() => instance.replaceProps({name: 'bar'})).toThrow(); expect(console.error.calls.length).toBe(5); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'getDOMNode(...) is deprecated in plain JavaScript React classes. ' + 'Use ReactDOM.findDOMNode(component) instead.' ); - expect(console.error.calls[1].args[0]).toContain( + expect(console.error.argsForCall[1][0]).toContain( 'replaceState(...) is deprecated in plain JavaScript React classes' ); - expect(console.error.calls[2].args[0]).toContain( + expect(console.error.argsForCall[2][0]).toContain( 'isMounted(...) is deprecated in plain JavaScript React classes' ); - expect(console.error.calls[3].args[0]).toContain( + expect(console.error.argsForCall[3][0]).toContain( 'setProps(...) is deprecated in plain JavaScript React classes' ); - expect(console.error.calls[4].args[0]).toContain( + expect(console.error.argsForCall[4][0]).toContain( 'replaceProps(...) is deprecated in plain JavaScript React classes' ); }); diff --git a/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js b/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js index 82dce67843..155c03beec 100644 --- a/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js +++ b/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js @@ -195,7 +195,7 @@ describe('ReactJSXElementValidator', function() { } } ReactTestUtils.renderIntoDocument(); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Invalid prop `color` of type `number` supplied to `MyComp`, ' + 'expected `string`. Check the render method of `ParentComp`.' @@ -214,19 +214,19 @@ describe('ReactJSXElementValidator', function() { void ; void ; expect(console.error.calls.length).toBe(4); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'type should not be null, undefined, boolean, or number. It should be ' + 'a string (for DOM elements) or a ReactClass (for composite components).' ); - expect(console.error.calls[1].args[0]).toContain( + expect(console.error.argsForCall[1][0]).toContain( 'type should not be null, undefined, boolean, or number. It should be ' + 'a string (for DOM elements) or a ReactClass (for composite components).' ); - expect(console.error.calls[2].args[0]).toContain( + expect(console.error.argsForCall[2][0]).toContain( 'type should not be null, undefined, boolean, or number. It should be ' + 'a string (for DOM elements) or a ReactClass (for composite components).' ); - expect(console.error.calls[3].args[0]).toContain( + expect(console.error.argsForCall[3][0]).toContain( 'type should not be null, undefined, boolean, or number. It should be ' + 'a string (for DOM elements) or a ReactClass (for composite components).' ); @@ -242,7 +242,7 @@ describe('ReactJSXElementValidator', function() { ReactTestUtils.renderIntoDocument(); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Required prop `prop` was not specified in `RequiredPropComponent`.' ); @@ -254,7 +254,7 @@ describe('ReactJSXElementValidator', function() { ReactTestUtils.renderIntoDocument(); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Required prop `prop` was not specified in `RequiredPropComponent`.' ); @@ -267,12 +267,12 @@ describe('ReactJSXElementValidator', function() { ReactTestUtils.renderIntoDocument(); expect(console.error.calls.length).toBe(2); - expect(console.error.calls[0].args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed propType: ' + 'Required prop `prop` was not specified in `RequiredPropComponent`.' ); - expect(console.error.calls[1].args[0]).toBe( + expect(console.error.argsForCall[1][0]).toBe( 'Warning: Failed propType: ' + 'Invalid prop `prop` of type `number` supplied to ' + '`RequiredPropComponent`, expected `string`.' @@ -300,7 +300,7 @@ describe('ReactJSXElementValidator', function() { }; ReactTestUtils.renderIntoDocument(); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'Invariant Violation: NullPropTypeComponent: prop type `prop` is ' + 'invalid; it must be a function, usually from React.PropTypes.' ); @@ -318,7 +318,7 @@ describe('ReactJSXElementValidator', function() { }; ReactTestUtils.renderIntoDocument(); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'Invariant Violation: NullContextTypeComponent: context type `prop` is ' + 'invalid; it must be a function, usually from React.PropTypes.' ); @@ -336,7 +336,7 @@ describe('ReactJSXElementValidator', function() { }); ReactTestUtils.renderIntoDocument(); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'getDefaultProps is only used on classic React.createClass definitions.' + ' Use a static property named `defaultProps` instead.' ); diff --git a/src/renderers/dom/client/__tests__/ReactMount-test.js b/src/renderers/dom/client/__tests__/ReactMount-test.js index 4291e60ce5..eaaa38f6ed 100644 --- a/src/renderers/dom/client/__tests__/ReactMount-test.js +++ b/src/renderers/dom/client/__tests__/ReactMount-test.js @@ -153,7 +153,7 @@ describe('ReactMount', function() { ReactMount.render(
, iFrame.contentDocument.body); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( 'Rendering components directly into document.body is discouraged' ); }); @@ -170,7 +170,7 @@ describe('ReactMount', function() { div ); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain( + expect(console.error.argsForCall[0][0]).toContain( ' (client) nbsp entity:   client text
\n' + ' (server) nbsp entity:   server text
' ); @@ -238,7 +238,7 @@ describe('ReactMount', function() { var rootNode = container.firstChild; ReactDOM.render(, rootNode); expect(console.error.calls.length).toBe(1); - expect(console.error.mostRecentCall.args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: render(...): Replacing React-rendered children with a new ' + 'root component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state and ' + diff --git a/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js b/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js index be92a11747..7878ebd4ba 100644 --- a/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js +++ b/src/renderers/dom/client/__tests__/ReactMountDestruction-test.js @@ -54,7 +54,7 @@ describe('ReactMount', function() { spyOn(console, 'error'); ReactDOM.unmountComponentAtNode(rootDiv); expect(console.error.calls.length).toBe(1); - expect(console.error.mostRecentCall.args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: unmountComponentAtNode(): The node you\'re attempting to ' + 'unmount was rendered by React and is not a top-level container. You ' + 'may have accidentally passed in a React root node instead of its ' + @@ -78,7 +78,7 @@ describe('ReactMount', function() { spyOn(console, 'error'); ReactDOM.unmountComponentAtNode(nonRootDiv); expect(console.error.calls.length).toBe(1); - expect(console.error.mostRecentCall.args[0]).toBe( + expect(console.error.argsForCall[0][0]).toBe( 'Warning: unmountComponentAtNode(): The node you\'re attempting to ' + 'unmount was rendered by React and is not a top-level container. ' + 'Instead, have the parent component update its state and rerender in ' + diff --git a/src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js b/src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js index 4a402dc358..38b5f6b35b 100644 --- a/src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js +++ b/src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js @@ -39,7 +39,7 @@ describe('ReactDOMOption', function() { expect(node.innerHTML).toBe('1 2'); expect(console.error.calls.length).toBe(1); - expect(console.error.calls[0].args[0]).toContain('Only strings and numbers are supported as