no-ssr: Add tests

This commit is contained in:
Sebastien Chopin 2017-08-24 12:46:30 +02:00
parent 222f50e139
commit e90a753d8d
2 changed files with 16 additions and 0 deletions

View File

@ -148,6 +148,17 @@ test('/redirect2', async t => {
t.true(output.stderr.length === 0)
})
test('/no-ssr', async t => {
const { html } = await nuxt.renderRoute('/no-ssr')
t.true(html.includes('<div class="no-ssr-placeholder">&lt;p&gt;Loading...&lt;/p&gt;</div>'))
})
test('/no-ssr (clien-side)', async t => {
const window = await nuxt.renderAndGetWindow(url('/no-ssr'))
const html = window.document.body.innerHTML
t.true(html.includes('<h1>Displayed only on client-side</h1>'))
})
test('ETag Header', async t => {
const { headers: { etag } } = await rp(url('/stateless'), { resolveWithFullResponse: true })
// Validate etag

5
test/fixtures/basic/pages/no-ssr.vue vendored Normal file
View File

@ -0,0 +1,5 @@
<template>
<no-ssr placeholder="<p>Loading...</p>">
<h1>Displayed only on client-side</h1>
</no-ssr>
</template>