mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
Add tests for layouts
This commit is contained in:
parent
048506ae35
commit
eebc44dca4
6
test/fixtures/with-config/layouts/custom.vue
vendored
Normal file
6
test/fixtures/with-config/layouts/custom.vue
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Custom layout</h1>
|
||||
<nuxt/>
|
||||
</div>
|
||||
</template>
|
6
test/fixtures/with-config/pages/about.vue
vendored
6
test/fixtures/with-config/pages/about.vue
vendored
@ -4,3 +4,9 @@
|
||||
<nuxt-link to="/">Home page</nuxt-link>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
layout: 'custom'
|
||||
}
|
||||
</script>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user