-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
12 changed files
with
108 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
13 changes: 13 additions & 0 deletions
13
test/e2e/app-dir/global-error/with-style-import/app/global-error.tsx
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,13 @@ | ||
'use client' | ||
|
||
import './global.css' | ||
|
||
export default function GlobalError() { | ||
return ( | ||
<html> | ||
<body> | ||
<h2>Error!</h2> | ||
</body> | ||
</html> | ||
) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/global-error/with-style-import/app/global.css
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 @@ | ||
h2 { | ||
color: yellow; | ||
} |
12 changes: 12 additions & 0 deletions
12
test/e2e/app-dir/global-error/with-style-import/app/layout.tsx
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,12 @@ | ||
// to avoid bailing out of the build | ||
export const dynamic = 'force-dynamic' | ||
|
||
export default function RootLayout({ children }) { | ||
throw new Error('Root Layout Error') | ||
|
||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
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 Home() { | ||
return <p>Home</p> | ||
} |
30 changes: 30 additions & 0 deletions
30
test/e2e/app-dir/global-error/with-style-import/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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { assertHasRedbox, getRedboxHeader } from 'next-test-utils' | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
async function testDev(browser, errorRegex) { | ||
await assertHasRedbox(browser) | ||
expect(await getRedboxHeader(browser)).toMatch(errorRegex) | ||
} | ||
|
||
describe('app dir - global error - with style import', () => { | ||
const { next, isNextDev, skipped } = nextTestSetup({ | ||
files: __dirname, | ||
skipDeployment: true, | ||
}) | ||
|
||
if (skipped) { | ||
return | ||
} | ||
|
||
it('should render global error with correct styles', async () => { | ||
const browser = await next.browser('/') | ||
|
||
if (isNextDev) { | ||
await testDev(browser, /Root Layout Error/) | ||
return | ||
} | ||
|
||
const h2 = await browser.elementByCss('h2') | ||
expect(await h2.getComputedCss('color')).toBe('rgb(255, 255, 0)') // yellow | ||
}) | ||
}) |