diff --git a/test/fixtures/basic/pages/client-only.vue b/test/fixtures/basic/pages/client-only.vue new file mode 100644 index 0000000000..cbcd7a0d09 --- /dev/null +++ b/test/fixtures/basic/pages/client-only.vue @@ -0,0 +1,7 @@ + diff --git a/test/unit/basic.ssr.test.js b/test/unit/basic.ssr.test.js index e6a23522d4..25e48f03c2 100644 --- a/test/unit/basic.ssr.test.js +++ b/test/unit/basic.ssr.test.js @@ -262,6 +262,19 @@ describe('basic ssr', () => { expect(redirected.status === 302).toBe(true) }) + test('/client-only', async () => { + const { html } = await nuxt.server.renderRoute('/client-only') + expect(html.includes( + '

Loading...

' + )).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') + }) + test('/no-ssr', async () => { const { html } = await nuxt.server.renderRoute('/no-ssr') expect(html.includes( @@ -273,6 +286,10 @@ describe('basic ssr', () => { const window = await nuxt.server.renderAndGetWindow(url('/no-ssr')) const html = window.document.body.innerHTML expect(html).toContain('Displayed only on client-side') + expect(consola.warn).toHaveBeenCalledTimes(1) + expect(consola.warn).toHaveBeenCalledWith( + expect.stringContaining(' has been deprecated') + ) }) test('ETag Header', async () => {