From 374768717df6c90f9c06b213a663d325739918e1 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Fri, 23 Feb 2024 19:04:12 -0500 Subject: [PATCH] Update tests --- .../src/__tests__/ReactDOMComponent-test.js | 39 +++++++++++-------- .../src/__tests__/ReactDOMFloat-test.js | 20 +++++----- .../src/__tests__/ReactDOMForm-test.js | 3 +- .../src/__tests__/ReactDOMOption-test.js | 5 ++- .../src/__tests__/validateDOMNesting-test.js | 37 ++++++++++++++---- 5 files changed, 67 insertions(+), 37 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js index 53ad186761b74..6541293f51333 100644 --- a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js @@ -2188,8 +2188,9 @@ describe('ReactDOMComponent', () => { ); }); }).toErrorDev([ - 'Warning: cannot appear as a child of ' + - '
.' + + 'Warning: In HTML, cannot be a child of ' + + '
.\n' + + 'This will cause a hydration error.' + '\n in tr (at **)' + '\n in div (at **)', ]); @@ -2208,8 +2209,9 @@ describe('ReactDOMComponent', () => { ); }); }).toErrorDev( - 'Warning:

cannot appear as a descendant ' + - 'of

.' + + 'Warning: In HTML,

cannot be a descendant ' + + 'of

.\n' + + 'This will cause a hydration error.' + // There is no outer `p` here because root container is not part of the stack. '\n in p (at **)' + '\n in span (at **)', @@ -2241,22 +2243,25 @@ describe('ReactDOMComponent', () => { root.render(); }); }).toErrorDev([ - 'Warning: cannot appear as a child of ' + + 'Warning: In HTML, cannot be a child of ' + '. Add a , or to your code to match the DOM tree generated ' + - 'by the browser.' + + 'by the browser.\n' + + 'This will cause a hydration error.' + '\n in tr (at **)' + '\n in Row (at **)' + '\n in table (at **)' + '\n in Foo (at **)', - 'Warning: Text nodes cannot appear as a ' + - 'child of .' + + 'Warning: In HTML, text nodes cannot be a ' + + 'child of .\n' + + 'This will cause a hydration error.' + '\n in tr (at **)' + '\n in Row (at **)' + '\n in table (at **)' + '\n in Foo (at **)', - 'Warning: Whitespace text nodes cannot ' + - "appear as a child of
. Make sure you don't have any extra " + - 'whitespace between tags on each line of your source code.' + + 'Warning: In HTML, whitespace text nodes cannot ' + + "be a child of
. Make sure you don't have any extra " + + 'whitespace between tags on each line of your source code.\n' + + 'This will cause a hydration error.' + '\n in table (at **)' + '\n in Foo (at **)', ]); @@ -2283,9 +2288,10 @@ describe('ReactDOMComponent', () => { root.render( ); }); }).toErrorDev([ - 'Warning: Whitespace text nodes cannot ' + - "appear as a child of
. Make sure you don't have any extra " + - 'whitespace between tags on each line of your source code.' + + 'Warning: In HTML, whitespace text nodes cannot ' + + "be a child of
. Make sure you don't have any extra " + + 'whitespace between tags on each line of your source code.\n' + + 'This will cause a hydration error.' + '\n in table (at **)' + '\n in Foo (at **)', ]); @@ -2311,8 +2317,9 @@ describe('ReactDOMComponent', () => { ); }); }).toErrorDev([ - 'Warning: Text nodes cannot appear as a ' + - 'child of .' + + 'Warning: In HTML, text nodes cannot be a ' + + 'child of .\n' + + 'This will cause a hydration error.' + '\n in tr (at **)' + '\n in Row (at **)' + '\n in tbody (at **)' + diff --git a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js index 64f79140917c8..31c1607cc149c 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js @@ -523,7 +523,7 @@ describe('ReactDOMFloat', () => { }).toErrorDev( [ 'Cannot render