mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
test: add client-only test to basic fixture (#6315)
test: check for no-ssr deprecation warning
This commit is contained in:
parent
61ef86e015
commit
b286024dd3
7
test/fixtures/basic/pages/client-only.vue
vendored
Normal file
7
test/fixtures/basic/pages/client-only.vue
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<client-only placeholder="Loading..." placeholder-tag="p">
|
||||||
|
<h1>Displayed only on client-side</h1>
|
||||||
|
</client-only>
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -262,6 +262,19 @@ describe('basic ssr', () => {
|
|||||||
expect(redirected.status === 302).toBe(true)
|
expect(redirected.status === 302).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('/client-only', async () => {
|
||||||
|
const { html } = await nuxt.server.renderRoute('/client-only')
|
||||||
|
expect(html.includes(
|
||||||
|
'<p class="client-only-placeholder">Loading...</p>'
|
||||||
|
)).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('/client-only (client-side)', async () => {
|
||||||
|
const window = await nuxt.server.renderAndGetWindow(url('/client-only'))
|
||||||
|
const html = window.document.body.innerHTML
|
||||||
|
expect(html).toContain('Displayed only on client-side</h1>')
|
||||||
|
})
|
||||||
|
|
||||||
test('/no-ssr', async () => {
|
test('/no-ssr', async () => {
|
||||||
const { html } = await nuxt.server.renderRoute('/no-ssr')
|
const { html } = await nuxt.server.renderRoute('/no-ssr')
|
||||||
expect(html.includes(
|
expect(html.includes(
|
||||||
@ -273,6 +286,10 @@ describe('basic ssr', () => {
|
|||||||
const window = await nuxt.server.renderAndGetWindow(url('/no-ssr'))
|
const window = await nuxt.server.renderAndGetWindow(url('/no-ssr'))
|
||||||
const html = window.document.body.innerHTML
|
const html = window.document.body.innerHTML
|
||||||
expect(html).toContain('Displayed only on client-side</h1>')
|
expect(html).toContain('Displayed only on client-side</h1>')
|
||||||
|
expect(consola.warn).toHaveBeenCalledTimes(1)
|
||||||
|
expect(consola.warn).toHaveBeenCalledWith(
|
||||||
|
expect.stringContaining('<no-ssr> has been deprecated')
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('ETag Header', async () => {
|
test('ETag Header', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user