Skip to content

Commit 35313aa

Browse files
committed
Rename toLowPriorityWarnDev -> toWarnDev in tests and implementation
1 parent aae46f6 commit 35313aa

13 files changed

Lines changed: 37 additions & 50 deletions

packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ describe('ReactComponentLifeCycle', () => {
697697
expect(() => ReactDOM.render(<Component />, container)).toErrorDev(
698698
'Unsafe legacy lifecycles will not be called for components using new component APIs.',
699699
);
700-
}).toLowPriorityWarnDev(
700+
}).toWarnDev(
701701
[
702702
'componentWillMount has been renamed',
703703
'componentWillReceiveProps has been renamed',
@@ -735,7 +735,7 @@ describe('ReactComponentLifeCycle', () => {
735735
).toErrorDev(
736736
'Unsafe legacy lifecycles will not be called for components using new component APIs.',
737737
);
738-
}).toLowPriorityWarnDev(
738+
}).toWarnDev(
739739
[
740740
'componentWillMount has been renamed',
741741
'componentWillReceiveProps has been renamed',
@@ -803,7 +803,7 @@ describe('ReactComponentLifeCycle', () => {
803803
'The above lifecycles should be removed. Learn more about this warning here:\n' +
804804
'https://fb.me/react-unsafe-component-lifecycles',
805805
);
806-
}).toLowPriorityWarnDev(
806+
}).toWarnDev(
807807
[
808808
'componentWillMount has been renamed',
809809
'componentWillUpdate has been renamed',
@@ -853,7 +853,7 @@ describe('ReactComponentLifeCycle', () => {
853853
'The above lifecycles should be removed. Learn more about this warning here:\n' +
854854
'https://fb.me/react-unsafe-component-lifecycles',
855855
);
856-
}).toLowPriorityWarnDev(['componentWillMount has been renamed'], {
856+
}).toWarnDev(['componentWillMount has been renamed'], {
857857
withoutStack: true,
858858
});
859859

@@ -876,7 +876,7 @@ describe('ReactComponentLifeCycle', () => {
876876
'The above lifecycles should be removed. Learn more about this warning here:\n' +
877877
'https://fb.me/react-unsafe-component-lifecycles',
878878
);
879-
}).toLowPriorityWarnDev(['componentWillReceiveProps has been renamed'], {
879+
}).toWarnDev(['componentWillReceiveProps has been renamed'], {
880880
withoutStack: true,
881881
});
882882
});
@@ -908,7 +908,7 @@ describe('ReactComponentLifeCycle', () => {
908908
'The above lifecycles should be removed. Learn more about this warning here:\n' +
909909
'https://fb.me/react-unsafe-component-lifecycles',
910910
);
911-
}).toLowPriorityWarnDev(
911+
}).toWarnDev(
912912
[
913913
'componentWillMount has been renamed',
914914
'componentWillUpdate has been renamed',
@@ -956,7 +956,7 @@ describe('ReactComponentLifeCycle', () => {
956956
'The above lifecycles should be removed. Learn more about this warning here:\n' +
957957
'https://fb.me/react-unsafe-component-lifecycles',
958958
);
959-
}).toLowPriorityWarnDev(['componentWillMount has been renamed'], {
959+
}).toWarnDev(['componentWillMount has been renamed'], {
960960
withoutStack: true,
961961
});
962962

@@ -978,7 +978,7 @@ describe('ReactComponentLifeCycle', () => {
978978
'The above lifecycles should be removed. Learn more about this warning here:\n' +
979979
'https://fb.me/react-unsafe-component-lifecycles',
980980
);
981-
}).toLowPriorityWarnDev(['componentWillReceiveProps has been renamed'], {
981+
}).toWarnDev(['componentWillReceiveProps has been renamed'], {
982982
withoutStack: true,
983983
});
984984
});
@@ -1111,9 +1111,7 @@ describe('ReactComponentLifeCycle', () => {
11111111
}
11121112

11131113
const div = document.createElement('div');
1114-
expect(() =>
1115-
ReactDOM.render(<MyComponent foo="bar" />, div),
1116-
).toLowPriorityWarnDev(
1114+
expect(() => ReactDOM.render(<MyComponent foo="bar" />, div)).toWarnDev(
11171115
[
11181116
'componentWillMount has been renamed',
11191117
'componentWillReceiveProps has been renamed',
@@ -1382,9 +1380,7 @@ describe('ReactComponentLifeCycle', () => {
13821380
}
13831381

13841382
const container = document.createElement('div');
1385-
expect(() =>
1386-
ReactDOM.render(<MyComponent x={1} />, container),
1387-
).toLowPriorityWarnDev(
1383+
expect(() => ReactDOM.render(<MyComponent x={1} />, container)).toWarnDev(
13881384
[
13891385
/* eslint-disable max-len */
13901386
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

packages/react-dom/src/__tests__/ReactCompositeComponent-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ describe('ReactCompositeComponent', () => {
165165
// Old API based on heuristic
166166
let container = document.createElement('div');
167167
container.innerHTML = markup;
168-
expect(() => ReactDOM.render(<Parent />, container)).toLowPriorityWarnDev(
168+
expect(() => ReactDOM.render(<Parent />, container)).toWarnDev(
169169
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
170170
'will stop working in React v17. Replace the ReactDOM.render() call ' +
171171
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',

packages/react-dom/src/__tests__/ReactDOMFiber-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ describe('ReactDOMFiber', () => {
257257
</div>,
258258
container,
259259
),
260-
).toLowPriorityWarnDev(
260+
).toWarnDev(
261261
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
262262
'and will be removed in React 17+. Update your code to use ' +
263263
'ReactDOM.createPortal() instead. It has the exact same API, ' +

packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ describe('ReactDOMServerLifecycles', () => {
225225
}
226226
}
227227

228-
expect(() =>
229-
ReactDOMServer.renderToString(<Component />),
230-
).toLowPriorityWarnDev('componentWillMount has been renamed');
228+
expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
229+
'componentWillMount has been renamed',
230+
);
231231
expect(log).toEqual(['componentWillMount', 'UNSAFE_componentWillMount']);
232232
});
233233

@@ -279,9 +279,9 @@ describe('ReactDOMServerLifecycles', () => {
279279
}
280280
}
281281

282-
expect(() =>
283-
ReactDOMServer.renderToString(<Component />),
284-
).toLowPriorityWarnDev('componentWillMount has been renamed');
282+
expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
283+
'componentWillMount has been renamed',
284+
);
285285
});
286286

287287
it('should warn about deprecated lifecycle hooks', () => {
@@ -292,9 +292,9 @@ describe('ReactDOMServerLifecycles', () => {
292292
}
293293
}
294294

295-
expect(() =>
296-
ReactDOMServer.renderToString(<Component />),
297-
).toLowPriorityWarnDev('componentWillMount has been renamed');
295+
expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
296+
'componentWillMount has been renamed',
297+
);
298298

299299
// De-duped
300300
ReactDOMServer.renderToString(<Component />);

packages/react-dom/src/__tests__/ReactRenderDocument-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('rendering React components at document', () => {
3535

3636
describe('with old implicit hydration API', () => {
3737
function expectDeprecationWarningWithFiber(callback) {
38-
expect(callback).toLowPriorityWarnDev(
38+
expect(callback).toWarnDev(
3939
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
4040
'will stop working in React v17. Replace the ReactDOM.render() call ' +
4141
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
@@ -197,7 +197,7 @@ describe('rendering React components at document', () => {
197197
expect(() => {
198198
expect(() =>
199199
ReactDOM.render(<Component text="Hello world" />, testDocument),
200-
).toLowPriorityWarnDev(
200+
).toWarnDev(
201201
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
202202
'will stop working in React v17. Replace the ReactDOM.render() call ' +
203203
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',

packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('ReactDOMServerHydration', () => {
8181

8282
expect(() => {
8383
instance = ReactDOM.render(<TestComponent name="x" />, element);
84-
}).toLowPriorityWarnDev(
84+
}).toWarnDev(
8585
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
8686
'will stop working in React v17. Replace the ReactDOM.render() call ' +
8787
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
@@ -355,12 +355,12 @@ describe('ReactDOMServerHydration', () => {
355355
const element = document.createElement('div');
356356
expect(() => {
357357
element.innerHTML = ReactDOMServer.renderToString(markup);
358-
}).toLowPriorityWarnDev('componentWillMount has been renamed');
358+
}).toWarnDev('componentWillMount has been renamed');
359359
expect(element.textContent).toBe('Hi');
360360

361361
expect(() => {
362362
ReactDOM.hydrate(markup, element);
363-
}).toLowPriorityWarnDev('componentWillMount has been renamed', {
363+
}).toWarnDev('componentWillMount has been renamed', {
364364
withoutStack: true,
365365
});
366366
expect(element.textContent).toBe('Hi');

packages/react-dom/src/__tests__/ReactTestUtils-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ describe('ReactTestUtils', () => {
5353
MockedComponent.prototype.render = jest.fn();
5454

5555
// Patch it up so it returns its children.
56-
expect(() =>
57-
ReactTestUtils.mockComponent(MockedComponent),
58-
).toLowPriorityWarnDev(
56+
expect(() => ReactTestUtils.mockComponent(MockedComponent)).toWarnDev(
5957
'ReactTestUtils.mockComponent() is deprecated. ' +
6058
'Use shallow rendering or jest.mock() instead.\n\n' +
6159
'See https://fb.me/test-utils-mock-component for more information.',

packages/react/src/__tests__/ReactES6Class-test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,11 @@ describe('ReactES6Class', () => {
521521

522522
it('should throw AND warn when trying to access classic APIs', () => {
523523
const instance = test(<Inner name="foo" />, 'DIV', 'foo');
524-
expect(() =>
525-
expect(() => instance.replaceState({})).toThrow(),
526-
).toLowPriorityWarnDev(
524+
expect(() => expect(() => instance.replaceState({})).toThrow()).toWarnDev(
527525
'replaceState(...) is deprecated in plain JavaScript React classes',
528526
{withoutStack: true},
529527
);
530-
expect(() =>
531-
expect(() => instance.isMounted()).toThrow(),
532-
).toLowPriorityWarnDev(
528+
expect(() => expect(() => instance.isMounted()).toThrow()).toWarnDev(
533529
'isMounted(...) is deprecated in plain JavaScript React classes',
534530
{withoutStack: true},
535531
);

packages/react/src/__tests__/ReactElementValidator-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ describe('ReactElementValidator', () => {
439439
}
440440

441441
let TestFactory = React.createFactory(TestComponent);
442-
expect(() => TestFactory.type).toLowPriorityWarnDev(
442+
expect(() => TestFactory.type).toWarnDev(
443443
'Warning: Factory.type is deprecated. Access the class directly before ' +
444444
'passing it to createFactory.',
445445
{withoutStack: true},

packages/react/src/__tests__/ReactStrictMode-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ Please update the following components: AsyncRoot`,
480480
],
481481
{withoutStack: true},
482482
);
483-
}).toLowPriorityWarnDev(
483+
}).toWarnDev(
484484
[
485485
/* eslint-disable max-len */
486486
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

0 commit comments

Comments
 (0)