mirror of https://github.com/vuejs/vitepress
parent
c5f37188a1
commit
956de3bfa2
@ -0,0 +1,8 @@
|
|||||||
|
<script setup>
|
||||||
|
import { useData } from 'vitepress'
|
||||||
|
const { page } = useData()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- @content -->
|
||||||
|
|
||||||
|
<pre class="params">{{ page.params }}</pre>
|
@ -0,0 +1,8 @@
|
|||||||
|
export default {
|
||||||
|
async paths() {
|
||||||
|
return [
|
||||||
|
{ params: { id: 'foo' }, content: `# Foo` },
|
||||||
|
{ params: { id: 'bar' }, content: `# Bar` }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
describe('dynamic routes', () => {
|
||||||
|
test('render correct content', async () => {
|
||||||
|
await goto('/dynamic-routes/foo')
|
||||||
|
expect(await page.textContent('h1')).toMatch('Foo')
|
||||||
|
expect(await page.textContent('pre.params')).toMatch('"id": "foo"')
|
||||||
|
|
||||||
|
await goto('/dynamic-routes/bar')
|
||||||
|
expect(await page.textContent('h1')).toMatch('Bar')
|
||||||
|
expect(await page.textContent('pre.params')).toMatch('"id": "bar"')
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in new issue