react-testing-library icon indicating copy to clipboard operation
react-testing-library copied to clipboard

Test layout.tsx file without having validateDOMNesting warning

Open mezzouhri opened this issue 2 years ago • 0 comments

Describe the feature you'd like:

As a user of react 18 with NextJS (with app directory), I would like to test routLayout.tsx file without having this warning : Warning: validateDOMNesting(...): <html> cannot appear as a child of <div>. at html at children

//routLayout.tsx:

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="fr" data-testid="rout-layout">
      <body className={inter.className}>{children}</body>
    </html>
  );
}

Suggested implementation:

Maybe by modifying the container options

Thank you so much for your help

mezzouhri avatar Nov 15 '23 14:11 mezzouhri