Add tests for layouts

This commit is contained in:
Sébastien Chopin 2016-12-24 18:50:40 +01:00
parent 048506ae35
commit eebc44dca4
3 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<template>
<div>
<h1>Custom layout</h1>
<nuxt/>
</div>
</template>

View File

@ -4,3 +4,9 @@
<nuxt-link to="/">Home page</nuxt-link>
</div>
</template>
<script>
export default {
layout: 'custom'
}
</script>

View File

@ -27,9 +27,17 @@ test('/', async t => {
test('/test/ (router base)', async t => {
const window = await nuxt.renderAndGetWindow(url('/test/'))
const html = window.document.body.innerHTML
t.true(html.includes('<h1>Default layout</h1>'))
t.true(html.includes('<h1>I have custom configurations</h1>'))
})
test('/test/about (custom layout)', async t => {
const window = await nuxt.renderAndGetWindow(url('/test/about'))
const html = window.document.body.innerHTML
t.true(html.includes('<h1>Custom layout</h1>'))
t.true(html.includes('<h1>About page</h1>'))
})
test('/test/env', async t => {
const window = await nuxt.renderAndGetWindow(url('/test/env'))
const html = window.document.body.innerHTML