Add test for layout with dash

This commit is contained in:
Sébastien Chopin 2016-12-25 21:09:14 +01:00
parent 8efe07f27e
commit 86fba7ae77
3 changed files with 8 additions and 0 deletions

View File

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

View File

@ -4,6 +4,7 @@
<script> <script>
export default { export default {
layout: 'custom-env',
data ({ env }) { data ({ env }) {
return { env } return { env }
} }

View File

@ -41,6 +41,7 @@ test('/test/about (custom layout)', async t => {
test('/test/env', async t => { test('/test/env', async t => {
const window = await nuxt.renderAndGetWindow(url('/test/env')) const window = await nuxt.renderAndGetWindow(url('/test/env'))
const html = window.document.body.innerHTML const html = window.document.body.innerHTML
t.true(html.includes('<h1>Custom env layout</h1>'))
t.true(html.includes('"bool": true')) t.true(html.includes('"bool": true'))
t.true(html.includes('"num": 23')) t.true(html.includes('"num": 23'))
t.true(html.includes('"string": "Nuxt.js"')) t.true(html.includes('"string": "Nuxt.js"'))