-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
missing html tag seems to work just fine now
- Loading branch information
Showing
1 changed file
with
2 additions
and
54 deletions.
There are no files selected for viewing
56 changes: 2 additions & 54 deletions
56
test/development/app-dir/missing-required-html-tags/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,12 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { getRedboxDescription, hasRedbox, retry } from 'next-test-utils' | ||
import { hasRedbox } from 'next-test-utils' | ||
|
||
describe('app-dir - missing required html tags', () => { | ||
const { next } = nextTestSetup({ files: __dirname }) | ||
|
||
it('should show error overlay', async () => { | ||
it('should not error', async () => { | ||
const browser = await next.browser('/') | ||
|
||
expect(await hasRedbox(browser)).toBe(true) | ||
expect(await getRedboxDescription(browser)).toMatchInlineSnapshot(` | ||
"The following tags are missing in the Root Layout: <html>, <body>. | ||
Read more at https://nextjs.org/docs/messages/missing-root-layout-tags" | ||
`) | ||
}) | ||
|
||
it('should hmr when you fix the error', async () => { | ||
const browser = await next.browser('/') | ||
|
||
await next.patchFile('app/layout.js', (code) => | ||
code.replace('return children', 'return <body>{children}</body>') | ||
) | ||
|
||
expect(await hasRedbox(browser)).toBe(true) | ||
expect(await getRedboxDescription(browser)).toMatchInlineSnapshot(` | ||
"The following tags are missing in the Root Layout: <html>. | ||
Read more at https://nextjs.org/docs/messages/missing-root-layout-tags" | ||
`) | ||
|
||
await next.patchFile('app/layout.js', (code) => | ||
code.replace( | ||
'return <body>{children}</body>', | ||
'return <html><body>{children}</body></html>' | ||
) | ||
) | ||
|
||
expect(await hasRedbox(browser)).toBe(false) | ||
expect(await browser.elementByCss('p').text()).toBe('hello world') | ||
|
||
// Reintroduce the bug, but only missing html tag | ||
await next.patchFile('app/layout.js', (code) => | ||
code.replace( | ||
'return <html><body>{children}</body></html>', | ||
'return children' | ||
) | ||
) | ||
|
||
await retry(async () => { | ||
expect(await hasRedbox(browser)).toBe(true) | ||
}) | ||
|
||
// Fix the issue again | ||
await next.patchFile('app/layout.js', (code) => | ||
code.replace( | ||
'return children', | ||
'return <html><body>{children}</body></html>' | ||
) | ||
) | ||
|
||
await retry(async () => { | ||
expect(await hasRedbox(browser)).toBe(false) | ||
}) | ||
}) | ||
}) |