-
Notifications
You must be signed in to change notification settings - Fork 27.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
test/development/app-dir/missing-required-html-tags-new-overlay/app/layout.js
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Layout({ children }) { | ||
return <body>{children}</body> | ||
} |
3 changes: 3 additions & 0 deletions
3
test/development/app-dir/missing-required-html-tags-new-overlay/app/page.js
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return <p>hello world</p> | ||
} |
47 changes: 47 additions & 0 deletions
47
...ment/app-dir/missing-required-html-tags-new-overlay/missing-html-tags-new-overlay.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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { | ||
assertHasRedbox, | ||
assertNoRedbox, | ||
getRedboxDescription, | ||
getToastErrorCount, | ||
hasErrorToast, | ||
retry, | ||
} from 'next-test-utils' | ||
import { outdent } from 'outdent' | ||
|
||
// TODO: merge with test/development/app-dir/missing-required-html-tags/index.test.ts | ||
// once new overlay is stable | ||
describe('app-dir - missing required html tags', () => { | ||
const { next } = nextTestSetup({ | ||
files: __dirname, | ||
}) | ||
|
||
it('should display correct error count in dev indicator', async () => { | ||
const browser = await next.browser('/') | ||
|
||
retry(async () => { | ||
expect(await hasErrorToast(browser)).toBe(true) | ||
}) | ||
// Dev indicator should show 1 error | ||
expect(await getToastErrorCount(browser)).toBe(1) | ||
|
||
await assertHasRedbox(browser) | ||
|
||
await retry(async () => { | ||
expect(await getRedboxDescription(browser)).toEqual(outdent` | ||
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>' | ||
) | ||
) | ||
|
||
await assertNoRedbox(browser) | ||
expect(await browser.elementByCss('p').text()).toBe('hello world') | ||
}) | ||
}) |
8 changes: 8 additions & 0 deletions
8
test/development/app-dir/missing-required-html-tags-new-overlay/next.config.js
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
module.exports = { | ||
experimental: { | ||
newDevOverlay: true, | ||
}, | ||
} |