Skip to content

Commit

Permalink
Merge branch 'canary' into fix/skip-trailing-slash-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Sep 6, 2023
2 parents b296ed2 + 16cbc82 commit 18b8cff
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use client'

export { ReadPathName as default } from '../../components/read-path-name'
3 changes: 3 additions & 0 deletions test/e2e/app-dir/app-basepath/app/use-pathname/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use client'

export { ReadPathName as default } from '../../components/read-path-name'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { usePathname } from 'next/navigation'

export function Page() {
export function ReadPathName() {
const pathname = usePathname()
return (
<div id="pathname" data-pathname={pathname}>
Expand Down
13 changes: 10 additions & 3 deletions test/e2e/app-dir/app-basepath/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import { createNextDescribe } from 'e2e-utils'
import { check } from 'next-test-utils'

createNextDescribe(
'app dir basepath',
'app dir - basepath',
{
files: __dirname,
skipDeployment: true,
dependencies: {
react: 'latest',
'react-dom': 'latest',
sass: 'latest',
},
},
Expand Down Expand Up @@ -43,5 +41,14 @@ createNextDescribe(
return 'success'
}, 'success')
})

it('should render usePathname without the basePath', async () => {
const pathnames = ['/use-pathname', '/use-pathname-another']
const validatorPromises = pathnames.map(async (pathname) => {
const $ = await next.render$('/base' + pathname)
expect($('#pathname').data('pathname')).toBe(pathname)
})
await Promise.all(validatorPromises)
})
}
)
3 changes: 0 additions & 3 deletions test/e2e/app-dir/base-path/app/dashboard/page.jsx

This file was deleted.

8 changes: 0 additions & 8 deletions test/e2e/app-dir/base-path/app/layout.jsx

This file was deleted.

3 changes: 0 additions & 3 deletions test/e2e/app-dir/base-path/app/page.jsx

This file was deleted.

19 changes: 0 additions & 19 deletions test/e2e/app-dir/base-path/index.test.ts

This file was deleted.

3 changes: 0 additions & 3 deletions test/e2e/app-dir/base-path/next.config.js

This file was deleted.

0 comments on commit 18b8cff

Please sign in to comment.