Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion e2e/react-router/basic-file-based/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 2 additions & 0 deletions e2e/react-router/basic-file-based/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
HeadContent,
Link,
Outlet,
createRootRoute,
Expand All @@ -25,6 +26,7 @@ function RootComponent() {

return (
<>
<HeadContent />
<div className="flex gap-2 p-2 text-lg border-b">
<button
data-testid="back-button"
Expand Down
7 changes: 7 additions & 0 deletions e2e/react-router/basic-file-based/src/routes/posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { Link, Outlet, createFileRoute } from '@tanstack/react-router'
import { fetchPosts } from '../posts'

export const Route = createFileRoute('/posts')({
head: () => ({
meta: [
{
title: 'Posts page',
},
],
}),
loader: fetchPosts,
component: PostsComponent,
})
Expand Down
8 changes: 8 additions & 0 deletions e2e/react-router/basic-file-based/tests/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,11 @@ test('structural sharing enabled', async ({ page }) => {
await page.getByTestId('link').click()
expect(await getRenderCount(page)).toBe(2)
})

test('Should change title on client side navigation', async ({ page }) => {
await page.goto('/')

await page.getByRole('link', { name: 'Posts' }).click()

await expect(page).toHaveTitle('Posts page')
})