From 58f17e95a3fa7214b8a07df8238266c95d9ca71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Garc=C3=ADa=20Herv=C3=A1s?= Date: Tue, 6 Aug 2024 19:52:17 +0200 Subject: [PATCH 1/4] Skip prop type check in test --- packages/mui-lab/src/Masonry/Masonry.test.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/mui-lab/src/Masonry/Masonry.test.js b/packages/mui-lab/src/Masonry/Masonry.test.js index 790ff5e3a16c19..8c3c2c77492e35 100644 --- a/packages/mui-lab/src/Masonry/Masonry.test.js +++ b/packages/mui-lab/src/Masonry/Masonry.test.js @@ -100,6 +100,7 @@ describe('', () => { }); it('should throw console error when children are empty', function test() { + // React 19 removed prop types support if (!/jsdom/.test(window.navigator.userAgent) || reactMajor >= 19) { this.skip(); } @@ -112,9 +113,14 @@ describe('', () => { if (/jsdom/.test(window.navigator.userAgent)) { this.skip(); } - expect(() => render()).toErrorDev( - 'Warning: Failed prop type: The prop `children` is marked as required in `ForwardRef(Masonry)`, but its value is `undefined`.', - ); + + // React 19 removed prop types support + if (reactMajor < 18) { + expect(() => render()).toErrorDev( + 'Warning: Failed prop type: The prop `children` is marked as required in `ForwardRef(Masonry)`, but its value is `undefined`.', + ); + } + expect(() => render()).not.to.throw(new TypeError()); }); }); From 39a3201fab60442b26efd95dd5165a4a84f9a554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Garc=C3=ADa=20Herv=C3=A1s?= Date: Tue, 6 Aug 2024 22:20:32 +0200 Subject: [PATCH 2/4] Update packages/mui-lab/src/Masonry/Masonry.test.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Diego Andai Signed-off-by: Aarón García Hervás --- packages/mui-lab/src/Masonry/Masonry.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mui-lab/src/Masonry/Masonry.test.js b/packages/mui-lab/src/Masonry/Masonry.test.js index 8c3c2c77492e35..d79510cbdd3d02 100644 --- a/packages/mui-lab/src/Masonry/Masonry.test.js +++ b/packages/mui-lab/src/Masonry/Masonry.test.js @@ -115,7 +115,7 @@ describe('', () => { } // React 19 removed prop types support - if (reactMajor < 18) { + if (reactMajor < 19) { expect(() => render()).toErrorDev( 'Warning: Failed prop type: The prop `children` is marked as required in `ForwardRef(Masonry)`, but its value is `undefined`.', ); From e139e03ca3dbe8381fa405ec6b331a4cedd4ec7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Garc=C3=ADa=20Herv=C3=A1s?= Date: Wed, 7 Aug 2024 13:56:48 +0200 Subject: [PATCH 3/4] Remove unnecessary assertion --- packages/mui-lab/src/Masonry/Masonry.test.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/mui-lab/src/Masonry/Masonry.test.js b/packages/mui-lab/src/Masonry/Masonry.test.js index d79510cbdd3d02..4e28c08063be1f 100644 --- a/packages/mui-lab/src/Masonry/Masonry.test.js +++ b/packages/mui-lab/src/Masonry/Masonry.test.js @@ -114,13 +114,6 @@ describe('', () => { this.skip(); } - // React 19 removed prop types support - if (reactMajor < 19) { - expect(() => render()).toErrorDev( - 'Warning: Failed prop type: The prop `children` is marked as required in `ForwardRef(Masonry)`, but its value is `undefined`.', - ); - } - expect(() => render()).not.to.throw(new TypeError()); }); }); From e2ddd85d1cf6f91f981ba9b8fd90af522efe5b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aar=C3=B3n=20Garc=C3=ADa=20Herv=C3=A1s?= Date: Wed, 7 Aug 2024 16:36:03 +0200 Subject: [PATCH 4/4] Revert "Remove unnecessary assertion" This reverts commit e139e03ca3dbe8381fa405ec6b331a4cedd4ec7a. --- packages/mui-lab/src/Masonry/Masonry.test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/mui-lab/src/Masonry/Masonry.test.js b/packages/mui-lab/src/Masonry/Masonry.test.js index 4e28c08063be1f..d79510cbdd3d02 100644 --- a/packages/mui-lab/src/Masonry/Masonry.test.js +++ b/packages/mui-lab/src/Masonry/Masonry.test.js @@ -114,6 +114,13 @@ describe('', () => { this.skip(); } + // React 19 removed prop types support + if (reactMajor < 19) { + expect(() => render()).toErrorDev( + 'Warning: Failed prop type: The prop `children` is marked as required in `ForwardRef(Masonry)`, but its value is `undefined`.', + ); + } + expect(() => render()).not.to.throw(new TypeError()); }); });