Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
bf545af7
Commit
bf545af7
authored
Apr 03, 2026
by
Jimmy Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add test for #82456 - layout scripts on 404 page with parallel routes
parent
daca04d0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
0 deletions
+83
-0
default.tsx
...r/parallel-routes-script-not-found/app/@modal/default.tsx
+3
-0
page.tsx
...-dir/parallel-routes-script-not-found/app/@modal/page.tsx
+3
-0
layout.tsx
...e/app-dir/parallel-routes-script-not-found/app/layout.tsx
+21
-0
not-found-checker.tsx
...arallel-routes-script-not-found/app/not-found-checker.tsx
+19
-0
not-found.tsx
...pp-dir/parallel-routes-script-not-found/app/not-found.tsx
+10
-0
page.tsx
...e2e/app-dir/parallel-routes-script-not-found/app/page.tsx
+3
-0
next.config.ts
...e/app-dir/parallel-routes-script-not-found/next.config.ts
+5
-0
parallel-routes-script-not-found.test.ts
...script-not-found/parallel-routes-script-not-found.test.ts
+19
-0
No files found.
test/e2e/app-dir/parallel-routes-script-not-found/app/@modal/default.tsx
0 → 100644
View file @
bf545af7
export
default
function
ModalDefault
()
{
return
null
}
test/e2e/app-dir/parallel-routes-script-not-found/app/@modal/page.tsx
0 → 100644
View file @
bf545af7
export
default
function
ModalPage
()
{
return
null
}
test/e2e/app-dir/parallel-routes-script-not-found/app/layout.tsx
0 → 100644
View file @
bf545af7
export
default
function
RootLayout
({
children
,
modal
,
}:
{
children
:
React
.
ReactNode
modal
:
React
.
ReactNode
})
{
return
(
<
html
lang=
"en"
>
<
body
>
<
script
dangerouslySetInnerHTML=
{
{
__html
:
'window.__LAYOUT_SCRIPT_RAN = true'
,
}
}
/>
{
children
}
{
modal
}
</
body
>
</
html
>
)
}
test/e2e/app-dir/parallel-routes-script-not-found/app/not-found-checker.tsx
0 → 100644
View file @
bf545af7
'use client'
import
{
useEffect
}
from
'react'
declare
global
{
interface
Window
{
__LAYOUT_SCRIPT_RAN
?:
boolean
}
}
export
function
ScriptChecker
()
{
useEffect
(()
=>
{
document
.
body
.
setAttribute
(
'data-script-ran'
,
String
(
!!
window
.
__LAYOUT_SCRIPT_RAN
)
)
},
[])
return
null
}
test/e2e/app-dir/parallel-routes-script-not-found/app/not-found.tsx
0 → 100644
View file @
bf545af7
import
{
ScriptChecker
}
from
'./not-found-checker'
export
default
function
NotFound
()
{
return
(
<
div
>
<
h1
>
404 - Not Found
</
h1
>
<
ScriptChecker
/>
</
div
>
)
}
test/e2e/app-dir/parallel-routes-script-not-found/app/page.tsx
0 → 100644
View file @
bf545af7
export
default
function
Home
()
{
return
<
p
>
Home Page
</
p
>
}
test/e2e/app-dir/parallel-routes-script-not-found/next.config.ts
0 → 100644
View file @
bf545af7
import
type
{
NextConfig
}
from
'next'
const
nextConfig
:
NextConfig
=
{}
export
default
nextConfig
test/e2e/app-dir/parallel-routes-script-not-found/parallel-routes-script-not-found.test.ts
0 → 100644
View file @
bf545af7
import
{
nextTestSetup
}
from
'e2e-utils'
describe
(
'parallel-routes-script-not-found'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
it
(
'layout script should execute on normal page with parallel routes'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/'
)
const
result
=
await
browser
.
eval
(
'window.__LAYOUT_SCRIPT_RAN'
)
expect
(
result
).
toBe
(
true
)
})
it
(
'layout script should execute on 404 page with parallel routes'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/nonexistent'
)
const
result
=
await
browser
.
eval
(
'window.__LAYOUT_SCRIPT_RAN'
)
expect
(
result
).
toBe
(
true
)
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment