Skip to content

Commit

Permalink
test inheritence of ssr setting
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Jan 25, 2024
1 parent e409ccf commit cee0dfe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/vike-react/.testRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,17 @@ function testRun(cmd: 'npm run dev' | 'npm run preview', isStem?: true) {
const pageContent = 'The Phantom MenaceRelease Date: 1999-05-19Director: George LucasProducer: Rick McCallum'
expect(await page.textContent('body')).toContain(pageContent)
})

test('ssr: false', async () => {
const html = await fetchHtml('/star-wars/4')
expect(html).toContain('<html')
// <head> is render to HTML
expect(html).toContain('<title>My Vike + React App</title>')
expect(html).toContain('<meta name="description" content="Demo showcasing Vike + React"/>')
expect(html).toContain('<link rel="icon" href="/assets/logo.svg" />')
// <body> isn't rendered to HTML
expect(html).not.toContain('<h1>')
expect(html).not.toContain('The Phantom Menace')
expect(html).toContain('<div id="page-view"></div>')
})
}
1 change: 1 addition & 0 deletions examples/vike-react/pages/+config.h.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import vikeReact from 'vike-react/config'

// Default configs (can be overriden by pages)
export default {
ssr: true,
Layout,
Head,
// <title>
Expand Down
3 changes: 3 additions & 0 deletions examples/vike-react/pages/star-wars/@id/+config.h.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
ssr: false
}

0 comments on commit cee0dfe

Please sign in to comment.