Commit 573cea15 authored by Jimmy Lai's avatar Jimmy Lai

fix: resolve metadata test expectations for parallel route title template

Remove children metadata from /test route so the test is deterministic
across bundlers. Webpack and Turbopack iterate parallel route keys in
different orders, so when both children and a named slot define a title,
the winner varies by bundler. By having only the @parallel slot define
metadata, the test unambiguously verifies the #77888 fix (layout title
template applied to parallel slot titles).
parent 487f3d3b
import type { Metadata } from 'next'
export const metadata: Metadata = {
title: 'Children Test',
}
export default function TestPage() {
return <p>Children Test Content</p>
}
......@@ -7,15 +7,14 @@ describe('app-dir - parallel-routes-metadata', () => {
})
it('should apply layout title template to parallel slot metadata', async () => {
// When both children and @parallel slots define metadata,
// the parallel slot title wins because it is processed after children.
// Only the @parallel slot defines metadata on this route (children has none).
// The key fix (#77888) is that the layout's title template is preserved
// and applied, rather than being reset to null by intermediate pages.
// and applied to the parallel slot's title, rather than being reset to null.
const browser = await next.browser('/test')
await retry(async () => {
const title = await browser.eval('document.title')
// The parallel slot title "Parallel Test" takes precedence, and the
// The parallel slot title "Parallel Test" is used, and the
// layout's template "%s | My App" is correctly applied to it.
expect(title).toBe('Parallel Test | My App')
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment