Consistently use `calls[n].args[n]` instead of `argsForCall[n][n]` for Jasmine spies
Matias Singers committed
Oct 11, 2015 at 15:56 UTC
f8f2be05ced25e49575c83d620ba2e222c49841e
15 files changed
+81
-81
src/addons/__tests__/ReactFragment-test.js
+3
-3
@@ -86,7 +86,7 @@ describe('ReactFragment', function() {
86
spyOn(console, 'error');
87
ReactFragment.create(null);
88
expect(console.error.calls.length).toBe(1);
89
- expect(console.error.calls[0].args[0]).toContain(
89
+ expect(console.error.argsForCall[0][0]).toContain(
90
'React.addons.createFragment only accepts a single object.'
91
);
92
});
@@ -95,7 +95,7 @@ describe('ReactFragment', function() {
95
spyOn(console, 'error');
96
ReactFragment.create([]);
97
expect(console.error.calls.length).toBe(1);
98
- expect(console.error.calls[0].args[0]).toContain(
98
+ expect(console.error.argsForCall[0][0]).toContain(
99
'React.addons.createFragment only accepts a single object.'
100
);
101
});
@@ -104,7 +104,7 @@ describe('ReactFragment', function() {
104
spyOn(console, 'error');
105
ReactFragment.create(<div />);
106
expect(console.error.calls.length).toBe(1);
107
- expect(console.error.calls[0].args[0]).toContain(
107
+ expect(console.error.argsForCall[0][0]).toContain(
108
'React.addons.createFragment does not accept a ReactElement without a ' +
109
'wrapper object.'
110
);
src/isomorphic/classic/class/__tests__/ReactClass-test.js
+1
-1
@@ -379,7 +379,7 @@ describe('ReactClass-spec', function() {
379
instance.getDOMNode();
380
381
expect(console.error.calls.length).toBe(1);
382
- expect(console.error.calls[0].args[0]).toContain(
382
+ expect(console.error.argsForCall[0][0]).toContain(
383
'MyComponent.getDOMNode(...) is deprecated. Please use ' +
384
'ReactDOM.findDOMNode(instance) instead.'
385
);
src/isomorphic/classic/element/__tests__/ReactElementClone-test.js
+1
-1
@@ -258,7 +258,7 @@ describe('ReactElementClone', function() {
258
});
259
ReactTestUtils.renderIntoDocument(React.createElement(GrandParent));
260
expect(console.error.argsForCall.length).toBe(1);
261
- expect(console.error.calls[0].args[0]).toBe(
261
+ expect(console.error.argsForCall[0][0]).toBe(
262
'Warning: Failed propType: ' +
263
'Invalid prop `color` of type `number` supplied to `Component`, ' +
264
'expected `string`. Check the render method of `Parent`.'
src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js
+11
-11
@@ -239,7 +239,7 @@ describe('ReactElementValidator', function() {
239
},
240
});
241
ReactTestUtils.renderIntoDocument(React.createElement(ParentComp));
242
- expect(console.error.calls[0].args[0]).toBe(
242
+ expect(console.error.argsForCall[0][0]).toBe(
243
'Warning: Failed propType: ' +
244
'Invalid prop `color` of type `number` supplied to `MyComp`, ' +
245
'expected `string`. Check the render method of `ParentComp`.'
@@ -253,22 +253,22 @@ describe('ReactElementValidator', function() {
253
React.createElement(true);
254
React.createElement(123);
255
expect(console.error.calls.length).toBe(4);
256
- expect(console.error.calls[0].args[0]).toBe(
256
+ expect(console.error.argsForCall[0][0]).toBe(
257
'Warning: React.createElement: type should not be null, undefined, ' +
258
'boolean, or number. It should be a string (for DOM elements) or a ' +
259
'ReactClass (for composite components).'
260
);
261
- expect(console.error.calls[1].args[0]).toBe(
261
+ expect(console.error.argsForCall[1][0]).toBe(
262
'Warning: React.createElement: type should not be null, undefined, ' +
263
'boolean, or number. It should be a string (for DOM elements) or a ' +
264
'ReactClass (for composite components).'
265
);
266
- expect(console.error.calls[2].args[0]).toBe(
266
+ expect(console.error.argsForCall[2][0]).toBe(
267
'Warning: React.createElement: type should not be null, undefined, ' +
268
'boolean, or number. It should be a string (for DOM elements) or a ' +
269
'ReactClass (for composite components).'
270
);
271
- expect(console.error.calls[3].args[0]).toBe(
271
+ expect(console.error.argsForCall[3][0]).toBe(
272
'Warning: React.createElement: type should not be null, undefined, ' +
273
'boolean, or number. It should be a string (for DOM elements) or a ' +
274
'ReactClass (for composite components).'
@@ -292,7 +292,7 @@ describe('ReactElementValidator', function() {
292
'but got: null. Check the render method of `ParentComp`.'
293
);
294
expect(console.error.calls.length).toBe(1);
295
- expect(console.error.calls[0].args[0]).toBe(
295
+ expect(console.error.argsForCall[0][0]).toBe(
296
'Warning: React.createElement: type should not be null, undefined, ' +
297
'boolean, or number. It should be a string (for DOM elements) or a ' +
298
'ReactClass (for composite components). Check the render method of ' +
@@ -316,7 +316,7 @@ describe('ReactElementValidator', function() {
316
ReactTestUtils.renderIntoDocument(React.createElement(Component));
317
318
expect(console.error.calls.length).toBe(1);
319
- expect(console.error.calls[0].args[0]).toBe(
319
+ expect(console.error.argsForCall[0][0]).toBe(
320
'Warning: Failed propType: ' +
321
'Required prop `prop` was not specified in `Component`.'
322
);
@@ -340,7 +340,7 @@ describe('ReactElementValidator', function() {
340
);
341
342
expect(console.error.calls.length).toBe(1);
343
- expect(console.error.calls[0].args[0]).toBe(
343
+ expect(console.error.argsForCall[0][0]).toBe(
344
'Warning: Failed propType: ' +
345
'Required prop `prop` was not specified in `Component`.'
346
);
@@ -366,12 +366,12 @@ describe('ReactElementValidator', function() {
366
);
367
368
expect(console.error.calls.length).toBe(2);
369
- expect(console.error.calls[0].args[0]).toBe(
369
+ expect(console.error.argsForCall[0][0]).toBe(
370
'Warning: Failed propType: ' +
371
'Required prop `prop` was not specified in `Component`.'
372
);
373
374
- expect(console.error.calls[1].args[0]).toBe(
374
+ expect(console.error.argsForCall[1][0]).toBe(
375
'Warning: Failed propType: ' +
376
'Invalid prop `prop` of type `number` supplied to ' +
377
'`Component`, expected `string`.'
@@ -402,7 +402,7 @@ describe('ReactElementValidator', function() {
402
);
403
404
expect(console.error.calls.length).toBe(1);
405
- expect(console.error.calls[0].args[0]).toBe(
405
+ expect(console.error.argsForCall[0][0]).toBe(
406
'Warning: Component: type specification of prop `myProp` is invalid; ' +
407
'the type checker function must return `null` or an `Error` but ' +
408
'returned a function. You may have forgotten to pass an argument to ' +
src/isomorphic/modern/class/__tests__/ReactCoffeeScriptClass-test.coffee
+12
-12
@@ -52,7 +52,7 @@ describe 'ReactCoffeeScriptClass', ->
52
ReactDOM.render React.createElement(Foo), container
53
).toThrow()
54
expect(console.error.calls.length).toBe(1)
55
- expect(console.error.calls[0].args[0]).toContain('No `render` method found on the returned component instance')
55
+ expect(console.error.argsForCall[0][0]).toContain('No `render` method found on the returned component instance')
56
57
it 'renders a simple stateless component with prop', ->
58
class Foo extends React.Component
@@ -293,16 +293,16 @@ describe 'ReactCoffeeScriptClass', ->
293
expect(getInitialStateWasCalled).toBe false
294
expect(getDefaultPropsWasCalled).toBe false
295
expect(console.error.calls.length).toBe 4
296
- expect(console.error.calls[0].args[0]).toContain(
296
+ expect(console.error.argsForCall[0][0]).toContain(
297
'getInitialState was defined on Foo, a plain JavaScript class.'
298
)
299
- expect(console.error.calls[1].args[0]).toContain(
299
+ expect(console.error.argsForCall[1][0]).toContain(
300
'getDefaultProps was defined on Foo, a plain JavaScript class.'
301
)
302
- expect(console.error.calls[2].args[0]).toContain(
302
+ expect(console.error.argsForCall[2][0]).toContain(
303
'propTypes was defined as an instance property on Foo.'
304
)
305
- expect(console.error.calls[3].args[0]).toContain(
305
+ expect(console.error.argsForCall[3][0]).toContain(
306
'contextTypes was defined as an instance property on Foo.'
307
)
308
@@ -318,7 +318,7 @@ describe 'ReactCoffeeScriptClass', ->
318
319
test React.createElement(NamedComponent), 'SPAN', 'foo'
320
expect(console.error.calls.length).toBe 1
321
- expect(console.error.calls[0].args[0]).toBe(
321
+ expect(console.error.argsForCall[0][0]).toBe(
322
'Warning: NamedComponent has a method called componentShouldUpdate().
323
Did you mean shouldComponentUpdate()? The name is phrased as a
324
question because the function is expected to return a value.'
@@ -336,7 +336,7 @@ describe 'ReactCoffeeScriptClass', ->
336
337
test React.createElement(NamedComponent), 'SPAN', 'foo'
338
expect(console.error.calls.length).toBe 1
339
- expect(console.error.calls[0].args[0]).toBe(
339
+ expect(console.error.argsForCall[0][0]).toBe(
340
'Warning: NamedComponent has a method called componentWillRecieveProps().
341
Did you mean componentWillReceiveProps()?'
342
)
@@ -351,19 +351,19 @@ describe 'ReactCoffeeScriptClass', ->
351
expect(-> instance.setProps name: 'bar').toThrow()
352
expect(-> instance.replaceProps name: 'bar').toThrow()
353
expect(console.error.calls.length).toBe 5
354
- expect(console.error.calls[0].args[0]).toContain(
354
+ expect(console.error.argsForCall[0][0]).toContain(
355
'getDOMNode(...) is deprecated in plain JavaScript React classes'
356
)
357
- expect(console.error.calls[1].args[0]).toContain(
357
+ expect(console.error.argsForCall[1][0]).toContain(
358
'replaceState(...) is deprecated in plain JavaScript React classes'
359
)
360
- expect(console.error.calls[2].args[0]).toContain(
360
+ expect(console.error.argsForCall[2][0]).toContain(
361
'isMounted(...) is deprecated in plain JavaScript React classes'
362
)
363
- expect(console.error.calls[3].args[0]).toContain(
363
+ expect(console.error.argsForCall[3][0]).toContain(
364
'setProps(...) is deprecated in plain JavaScript React classes'
365
)
366
- expect(console.error.calls[4].args[0]).toContain(
366
+ expect(console.error.argsForCall[4][0]).toContain(
367
'replaceProps(...) is deprecated in plain JavaScript React classes'
368
)
369
src/isomorphic/modern/class/__tests__/ReactES6Class-test.js
+12
-12
@@ -62,7 +62,7 @@ describe('ReactES6Class', function() {
62
expect(() => ReactDOM.render(<Foo />, container)).toThrow();
63
64
expect(console.error.calls.length).toBe(1);
65
- expect(console.error.calls[0].args[0]).toBe(
65
+ expect(console.error.argsForCall[0][0]).toBe(
66
'Warning: Foo(...): No `render` method found on the returned component ' +
67
'instance: you may have forgotten to define `render`, returned ' +
68
'null/false from a stateless component, or tried to render an element ' +
@@ -343,16 +343,16 @@ describe('ReactES6Class', function() {
343
expect(getInitialStateWasCalled).toBe(false);
344
expect(getDefaultPropsWasCalled).toBe(false);
345
expect(console.error.calls.length).toBe(4);
346
- expect(console.error.calls[0].args[0]).toContain(
346
+ expect(console.error.argsForCall[0][0]).toContain(
347
'getInitialState was defined on Foo, a plain JavaScript class.'
348
);
349
- expect(console.error.calls[1].args[0]).toContain(
349
+ expect(console.error.argsForCall[1][0]).toContain(
350
'getDefaultProps was defined on Foo, a plain JavaScript class.'
351
);
352
- expect(console.error.calls[2].args[0]).toContain(
352
+ expect(console.error.argsForCall[2][0]).toContain(
353
'propTypes was defined as an instance property on Foo.'
354
);
355
- expect(console.error.calls[3].args[0]).toContain(
355
+ expect(console.error.argsForCall[3][0]).toContain(
356
'contextTypes was defined as an instance property on Foo.'
357
);
358
});
@@ -371,7 +371,7 @@ describe('ReactES6Class', function() {
371
test(<NamedComponent />, 'SPAN', 'foo');
372
373
expect(console.error.calls.length).toBe(1);
374
- expect(console.error.calls[0].args[0]).toBe(
374
+ expect(console.error.argsForCall[0][0]).toBe(
375
'Warning: ' +
376
'NamedComponent has a method called componentShouldUpdate(). Did you ' +
377
'mean shouldComponentUpdate()? The name is phrased as a question ' +
@@ -393,7 +393,7 @@ describe('ReactES6Class', function() {
393
test(<NamedComponent />, 'SPAN', 'foo');
394
395
expect(console.error.calls.length).toBe(1);
396
- expect(console.error.calls[0].args[0]).toBe(
396
+ expect(console.error.argsForCall[0][0]).toBe(
397
'Warning: ' +
398
'NamedComponent has a method called componentWillRecieveProps(). Did ' +
399
'you mean componentWillReceiveProps()?'
@@ -409,20 +409,20 @@ describe('ReactES6Class', function() {
409
expect(() => instance.setProps({name: 'bar'})).toThrow();
410
expect(() => instance.replaceProps({name: 'bar'})).toThrow();
411
expect(console.error.calls.length).toBe(5);
412
- expect(console.error.calls[0].args[0]).toContain(
412
+ expect(console.error.argsForCall[0][0]).toContain(
413
'getDOMNode(...) is deprecated in plain JavaScript React classes. ' +
414
'Use ReactDOM.findDOMNode(component) instead.'
415
);
416
- expect(console.error.calls[1].args[0]).toContain(
416
+ expect(console.error.argsForCall[1][0]).toContain(
417
'replaceState(...) is deprecated in plain JavaScript React classes'
418
);
419
- expect(console.error.calls[2].args[0]).toContain(
419
+ expect(console.error.argsForCall[2][0]).toContain(
420
'isMounted(...) is deprecated in plain JavaScript React classes'
421
);
422
- expect(console.error.calls[3].args[0]).toContain(
422
+ expect(console.error.argsForCall[3][0]).toContain(
423
'setProps(...) is deprecated in plain JavaScript React classes'
424
);
425
- expect(console.error.calls[4].args[0]).toContain(
425
+ expect(console.error.argsForCall[4][0]).toContain(
426
'replaceProps(...) is deprecated in plain JavaScript React classes'
427
);
428
});
src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js
+12
-12
@@ -195,7 +195,7 @@ describe('ReactJSXElementValidator', function() {
195
}
196
}
197
ReactTestUtils.renderIntoDocument(<ParentComp />);
198
- expect(console.error.calls[0].args[0]).toBe(
198
+ expect(console.error.argsForCall[0][0]).toBe(
199
'Warning: Failed propType: ' +
200
'Invalid prop `color` of type `number` supplied to `MyComp`, ' +
201
'expected `string`. Check the render method of `ParentComp`.'
@@ -214,19 +214,19 @@ describe('ReactJSXElementValidator', function() {
214
void <True />;
215
void <Num />;
216
expect(console.error.calls.length).toBe(4);
217
- expect(console.error.calls[0].args[0]).toContain(
217
+ expect(console.error.argsForCall[0][0]).toContain(
218
'type should not be null, undefined, boolean, or number. It should be ' +
219
'a string (for DOM elements) or a ReactClass (for composite components).'
220
);
221
- expect(console.error.calls[1].args[0]).toContain(
221
+ expect(console.error.argsForCall[1][0]).toContain(
222
'type should not be null, undefined, boolean, or number. It should be ' +
223
'a string (for DOM elements) or a ReactClass (for composite components).'
224
);
225
- expect(console.error.calls[2].args[0]).toContain(
225
+ expect(console.error.argsForCall[2][0]).toContain(
226
'type should not be null, undefined, boolean, or number. It should be ' +
227
'a string (for DOM elements) or a ReactClass (for composite components).'
228
);
229
- expect(console.error.calls[3].args[0]).toContain(
229
+ expect(console.error.argsForCall[3][0]).toContain(
230
'type should not be null, undefined, boolean, or number. It should be ' +
231
'a string (for DOM elements) or a ReactClass (for composite components).'
232
);
@@ -242,7 +242,7 @@ describe('ReactJSXElementValidator', function() {
242
ReactTestUtils.renderIntoDocument(<RequiredPropComponent />);
243
244
expect(console.error.calls.length).toBe(1);
245
- expect(console.error.calls[0].args[0]).toBe(
245
+ expect(console.error.argsForCall[0][0]).toBe(
246
'Warning: Failed propType: ' +
247
'Required prop `prop` was not specified in `RequiredPropComponent`.'
248
);
@@ -254,7 +254,7 @@ describe('ReactJSXElementValidator', function() {
254
ReactTestUtils.renderIntoDocument(<RequiredPropComponent prop={null} />);
255
256
expect(console.error.calls.length).toBe(1);
257
- expect(console.error.calls[0].args[0]).toBe(
257
+ expect(console.error.argsForCall[0][0]).toBe(
258
'Warning: Failed propType: ' +
259
'Required prop `prop` was not specified in `RequiredPropComponent`.'
260
);
@@ -267,12 +267,12 @@ describe('ReactJSXElementValidator', function() {
267
ReactTestUtils.renderIntoDocument(<RequiredPropComponent prop={42} />);
268
269
expect(console.error.calls.length).toBe(2);
270
- expect(console.error.calls[0].args[0]).toBe(
270
+ expect(console.error.argsForCall[0][0]).toBe(
271
'Warning: Failed propType: ' +
272
'Required prop `prop` was not specified in `RequiredPropComponent`.'
273
);
274
275
- expect(console.error.calls[1].args[0]).toBe(
275
+ expect(console.error.argsForCall[1][0]).toBe(
276
'Warning: Failed propType: ' +
277
'Invalid prop `prop` of type `number` supplied to ' +
278
'`RequiredPropComponent`, expected `string`.'
@@ -300,7 +300,7 @@ describe('ReactJSXElementValidator', function() {
300
};
301
ReactTestUtils.renderIntoDocument(<NullPropTypeComponent />);
302
expect(console.error.calls.length).toBe(1);
303
- expect(console.error.calls[0].args[0]).toContain(
303
+ expect(console.error.argsForCall[0][0]).toContain(
304
'Invariant Violation: NullPropTypeComponent: prop type `prop` is ' +
305
'invalid; it must be a function, usually from React.PropTypes.'
306
);
@@ -318,7 +318,7 @@ describe('ReactJSXElementValidator', function() {
318
};
319
ReactTestUtils.renderIntoDocument(<NullContextTypeComponent />);
320
expect(console.error.calls.length).toBe(1);
321
- expect(console.error.calls[0].args[0]).toContain(
321
+ expect(console.error.argsForCall[0][0]).toContain(
322
'Invariant Violation: NullContextTypeComponent: context type `prop` is ' +
323
'invalid; it must be a function, usually from React.PropTypes.'
324
);
@@ -336,7 +336,7 @@ describe('ReactJSXElementValidator', function() {
336
});
337
ReactTestUtils.renderIntoDocument(<GetDefaultPropsComponent />);
338
expect(console.error.calls.length).toBe(1);
339
- expect(console.error.calls[0].args[0]).toContain(
339
+ expect(console.error.argsForCall[0][0]).toContain(
340
'getDefaultProps is only used on classic React.createClass definitions.' +
341
' Use a static property named `defaultProps` instead.'
342
);
src/renderers/dom/client/__tests__/ReactMount-test.js
+3
-3
@@ -153,7 +153,7 @@ describe('ReactMount', function() {
153
ReactMount.render(<div />, iFrame.contentDocument.body);
154
155
expect(console.error.calls.length).toBe(1);
156
- expect(console.error.calls[0].args[0]).toContain(
156
+ expect(console.error.argsForCall[0][0]).toContain(
157
'Rendering components directly into document.body is discouraged'
158
);
159
});
@@ -170,7 +170,7 @@ describe('ReactMount', function() {
170
div
171
);
172
expect(console.error.calls.length).toBe(1);
173
- expect(console.error.calls[0].args[0]).toContain(
173
+ expect(console.error.argsForCall[0][0]).toContain(
174
' (client) nbsp entity: client text</div>\n' +
175
' (server) nbsp entity: server text</div>'
176
);
@@ -238,7 +238,7 @@ describe('ReactMount', function() {
238
var rootNode = container.firstChild;
239
ReactDOM.render(<span />, rootNode);
240
expect(console.error.calls.length).toBe(1);
241
- expect(console.error.mostRecentCall.args[0]).toBe(
241
+ expect(console.error.argsForCall[0][0]).toBe(
242
'Warning: render(...): Replacing React-rendered children with a new ' +
243
'root component. If you intended to update the children of this node, ' +
244
'you should instead have the existing children update their state and ' +
src/renderers/dom/client/__tests__/ReactMountDestruction-test.js
+2
-2
@@ -54,7 +54,7 @@ describe('ReactMount', function() {
54
spyOn(console, 'error');
55
ReactDOM.unmountComponentAtNode(rootDiv);
56
expect(console.error.calls.length).toBe(1);
57
- expect(console.error.mostRecentCall.args[0]).toBe(
57
+ expect(console.error.argsForCall[0][0]).toBe(
58
'Warning: unmountComponentAtNode(): The node you\'re attempting to ' +
59
'unmount was rendered by React and is not a top-level container. You ' +
60
'may have accidentally passed in a React root node instead of its ' +
@@ -78,7 +78,7 @@ describe('ReactMount', function() {
78
spyOn(console, 'error');
79
ReactDOM.unmountComponentAtNode(nonRootDiv);
80
expect(console.error.calls.length).toBe(1);
81
- expect(console.error.mostRecentCall.args[0]).toBe(
81
+ expect(console.error.argsForCall[0][0]).toBe(
82
'Warning: unmountComponentAtNode(): The node you\'re attempting to ' +
83
'unmount was rendered by React and is not a top-level container. ' +
84
'Instead, have the parent component update its state and rerender in ' +
src/renderers/dom/client/wrappers/__tests__/ReactDOMOption-test.js
+2
-2
@@ -39,7 +39,7 @@ describe('ReactDOMOption', function() {
39
40
expect(node.innerHTML).toBe('1 2');
41
expect(console.error.calls.length).toBe(1);
42
- expect(console.error.calls[0].args[0]).toContain('Only strings and numbers are supported as <option> children.');
42
+ expect(console.error.argsForCall[0][0]).toContain('Only strings and numbers are supported as <option> children.');
43
});
44
45
it('should warn when passing invalid children', function() {
@@ -48,7 +48,7 @@ describe('ReactDOMOption', function() {
48
stub = ReactTestUtils.renderIntoDocument(stub);
49
50
expect(console.error.calls.length).toBe(1);
51
- expect(console.error.calls[0].args[0]).toContain(
51
+ expect(console.error.argsForCall[0][0]).toContain(
52
'Only strings and numbers are supported as <option> children.'
53
);
54
});
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+17
-17
@@ -819,7 +819,7 @@ describe('ReactDOMComponent', function() {
819
spyOn(console, 'error');
820
ReactTestUtils.renderIntoDocument(<div onScroll={function() {}} />);
821
expect(console.error.calls.length).toBe(1);
822
- expect(console.error.mostRecentCall.args[0]).toBe(
822
+ expect(console.error.argsForCall[0][0]).toBe(
823
'Warning: This browser doesn\'t support the `onScroll` event'
824
);
825
});
@@ -859,7 +859,7 @@ describe('ReactDOMComponent', function() {
859
ReactTestUtils.renderIntoDocument(<div><tr /><tr /></div>);
860
861
expect(console.error.calls.length).toBe(1);
862
- expect(console.error.calls[0].args[0]).toBe(
862
+ expect(console.error.argsForCall[0][0]).toBe(
863
'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
864
'<div>. See div > tr.'
865
);
@@ -871,7 +871,7 @@ describe('ReactDOMComponent', function() {
871
ReactDOM.render(<span><p /></span>, p);
872
873
expect(console.error.calls.length).toBe(1);
874
- expect(console.error.calls[0].args[0]).toBe(
874
+ expect(console.error.argsForCall[0][0]).toBe(
875
'Warning: validateDOMNesting(...): <p> cannot appear as a descendant ' +
876
'of <p>. See p > ... > p.'
877
);
@@ -892,7 +892,7 @@ describe('ReactDOMComponent', function() {
892
ReactTestUtils.renderIntoDocument(<Foo />);
893
894
expect(console.error.calls.length).toBe(1);
895
- expect(console.error.calls[0].args[0]).toBe(
895
+ expect(console.error.argsForCall[0][0]).toBe(
896
'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
897
'<table>. See Foo > table > Row > tr. Add a <tbody> to your code to ' +
898
'match the DOM tree generated by the browser.'
@@ -926,7 +926,7 @@ describe('ReactDOMComponent', function() {
926
});
927
ReactTestUtils.renderIntoDocument(<App1 />);
928
expect(console.error.calls.length).toBe(1);
929
- expect(console.error.calls[0].args[0]).toContain(
929
+ expect(console.error.argsForCall[0][0]).toContain(
930
'See Viz1 > table > FancyRow > Row > tr.'
931
);
932
@@ -938,25 +938,25 @@ describe('ReactDOMComponent', function() {
938
});
939
ReactTestUtils.renderIntoDocument(<App2 />);
940
expect(console.error.calls.length).toBe(2);
941
- expect(console.error.calls[1].args[0]).toContain(
941
+ expect(console.error.argsForCall[1][0]).toContain(
942
'See Viz2 > FancyTable > Table > table > FancyRow > Row > tr.'
943
);
944
945
ReactTestUtils.renderIntoDocument(<FancyTable><FancyRow /></FancyTable>);
946
expect(console.error.calls.length).toBe(3);
947
- expect(console.error.calls[2].args[0]).toContain(
947
+ expect(console.error.argsForCall[2][0]).toContain(
948
'See FancyTable > Table > table > FancyRow > Row > tr.'
949
);
950
951
ReactTestUtils.renderIntoDocument(<table><FancyRow /></table>);
952
expect(console.error.calls.length).toBe(4);
953
- expect(console.error.calls[3].args[0]).toContain(
953
+ expect(console.error.argsForCall[3][0]).toContain(
954
'See table > FancyRow > Row > tr.'
955
);
956
957
ReactTestUtils.renderIntoDocument(<FancyTable><tr /></FancyTable>);
958
expect(console.error.calls.length).toBe(5);
959
- expect(console.error.calls[4].args[0]).toContain(
959
+ expect(console.error.argsForCall[4][0]).toContain(
960
'See FancyTable > Table > table > tr.'
961
);
962
@@ -967,7 +967,7 @@ describe('ReactDOMComponent', function() {
967
});
968
ReactTestUtils.renderIntoDocument(<Link><div><Link /></div></Link>);
969
expect(console.error.calls.length).toBe(6);
970
- expect(console.error.calls[5].args[0]).toContain(
970
+ expect(console.error.argsForCall[5][0]).toContain(
971
'See Link > a > ... > Link > a.'
972
);
973
});
@@ -1002,27 +1002,27 @@ describe('ReactDOMComponent', function() {
1002
expect(innerDiv.isMounted()).toBe(false);
1003
1004
expect(console.error.calls.length).toBe(5);
1005
- expect(console.error.calls[0].args[0]).toBe(
1005
+ expect(console.error.argsForCall[0][0]).toBe(
1006
'Warning: ReactDOMComponent: Do not access .props of a DOM ' +
1007
'node; instead, recreate the props as `render` did originally or ' +
1008
'read the DOM properties/attributes directly from this node (e.g., ' +
1009
'this.refs.box.className). This DOM node was rendered by `Animal`.'
1010
);
1011
- expect(console.error.calls[1].args[0]).toBe(
1011
+ expect(console.error.argsForCall[1][0]).toBe(
1012
'Warning: ReactDOMComponent: Do not access .setState(), ' +
1013
'.replaceState(), or .forceUpdate() of a DOM node. This is a no-op. ' +
1014
'This DOM node was rendered by `Animal`.'
1015
);
1016
- expect(console.error.calls[2].args[0]).toBe(
1016
+ expect(console.error.argsForCall[2][0]).toBe(
1017
'Warning: ReactDOMComponent: Do not access .getDOMNode() of a DOM ' +
1018
'node; instead, use the node directly. This DOM node was ' +
1019
'rendered by `Animal`.'
1020
);
1021
- expect(console.error.calls[3].args[0]).toBe(
1021
+ expect(console.error.argsForCall[3][0]).toBe(
1022
'Warning: ReactDOMComponent: Do not access .isMounted() of a DOM ' +
1023
'node. This DOM node was rendered by `Animal`.'
1024
);
1025
- expect(console.error.calls[4].args[0]).toContain('isMounted');
1025
+ expect(console.error.argsForCall[4][0]).toContain('isMounted');
1026
});
1027
1028
it('handles legacy setProps and replaceProps', function() {
@@ -1038,11 +1038,11 @@ describe('ReactDOMComponent', function() {
1038
expect(node.textContent).toBe('');
1039
1040
expect(console.error.calls.length).toBe(2);
1041
- expect(console.error.calls[0].args[0]).toBe(
1041
+ expect(console.error.argsForCall[0][0]).toBe(
1042
'Warning: ReactDOMComponent: Do not access .setProps() of a DOM node. ' +
1043
'Instead, call ReactDOM.render again at the top level.'
1044
);
1045
- expect(console.error.calls[1].args[0]).toBe(
1045
+ expect(console.error.argsForCall[1][0]).toBe(
1046
'Warning: ReactDOMComponent: Do not access .replaceProps() of a DOM ' +
1047
'node. Instead, call ReactDOM.render again at the top level.'
1048
);
src/renderers/shared/reconciler/__tests__/ReactComponent-test.js
+1
-1
@@ -284,7 +284,7 @@ describe('ReactComponent', function() {
284
instance.getDOMNode();
285
286
expect(console.error.calls.length).toBe(1);
287
- expect(console.error.calls[0].args[0]).toContain(
287
+ expect(console.error.argsForCall[0][0]).toContain(
288
'Potato.getDOMNode(...) is deprecated. Please use ' +
289
'ReactDOM.findDOMNode(instance) instead.'
290
);
src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
+1
-1
@@ -1075,7 +1075,7 @@ describe('ReactCompositeComponent', function() {
1075
ReactTestUtils.renderIntoDocument(<div><NotAComponent /></div>);
1076
}).toThrow(); // has no method 'render'
1077
expect(console.error.calls.length).toBe(1);
1078
- expect(console.error.calls[0].args[0]).toContain(
1078
+ expect(console.error.argsForCall[0][0]).toContain(
1079
'NotAComponent(...): No `render` method found'
1080
);
1081
});
src/renderers/shared/reconciler/__tests__/ReactMultiChildText-test.js
+1
-1
@@ -187,7 +187,7 @@ describe('ReactMultiChildText', function() {
187
['', 'foo', <div>{true}{<div />}{1.2}{''}</div>, 'foo'], ['', 'foo', <div />, 'foo'],
188
]);
189
expect(console.error.calls.length).toBe(1);
190
- expect(console.error.calls[0].args[0]).toContain('Warning: Each child in an array or iterator should have a unique "key" prop.');
190
+ expect(console.error.argsForCall[0][0]).toContain('Warning: Each child in an array or iterator should have a unique "key" prop.');
191
});
192
193
it('should throw if rendering both HTML and children', function() {
src/shared/utils/__tests__/traverseAllChildren-test.js
+2
-2
@@ -82,7 +82,7 @@ describe('traverseAllChildren', function() {
82
);
83
expect(traverseContext.length).toEqual(1);
84
expect(console.error.calls.length).toBe(1);
85
- expect(console.error.calls[0].args[0]).toContain('Warning: Each child in an array or iterator should have a unique "key" prop.');
85
+ expect(console.error.argsForCall[0][0]).toContain('Warning: Each child in an array or iterator should have a unique "key" prop.');
86
});
87
88
it('should be called for each child', function() {
@@ -326,7 +326,7 @@ describe('traverseAllChildren', function() {
326
);
327
328
expect(console.error.calls.length).toBe(1);
329
- expect(console.error.calls[0].args[0]).toContain('Warning: Each child in an array or iterator should have a unique "key" prop.');
329
+ expect(console.error.argsForCall[0][0]).toContain('Warning: Each child in an array or iterator should have a unique "key" prop.');
330
});
331
332
it('should be called for each child in an iterable with keys', function() {