Add vuex nested modules test

This commit is contained in:
Sébastien Chopin 2017-03-26 00:53:50 +01:00
parent 617999a60a
commit 0c85656142
3 changed files with 25 additions and 0 deletions

View File

@ -42,6 +42,11 @@ test('/stateful', async t => {
t.true(html.includes('<div><p>The answer is 42</p></div>')) t.true(html.includes('<div><p>The answer is 42</p></div>'))
}) })
test('/store', async t => {
const { html } = await nuxt.renderRoute('/store')
t.true(html.includes('<h1>Vuex Nested Modules</h1>'))
})
test('/head', async t => { test('/head', async t => {
const window = await nuxt.renderAndGetWindow(url('/head'), { virtualConsole: false }) const window = await nuxt.renderAndGetWindow(url('/head'), { virtualConsole: false })
const html = window.document.body.innerHTML const html = window.document.body.innerHTML

11
test/fixtures/basic/pages/store.vue vendored Normal file
View File

@ -0,0 +1,11 @@
<template>
<h1>{{ baz }}</h1>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
computed: mapGetters('foo/bar', ['baz'])
}
</script>

9
test/fixtures/basic/store/foo/bar.js vendored Normal file
View File

@ -0,0 +1,9 @@
export const state = {
baz: 'Vuex Nested Modules'
}
export const getters = {
baz (state) {
return state.baz
}
}