mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
Add vuex nested modules test
This commit is contained in:
parent
617999a60a
commit
0c85656142
@ -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
11
test/fixtures/basic/pages/store.vue
vendored
Normal 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
9
test/fixtures/basic/store/foo/bar.js
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export const state = {
|
||||||
|
baz: 'Vuex Nested Modules'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getters = {
|
||||||
|
baz (state) {
|
||||||
|
return state.baz
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user