diff --git a/test/basic.csr.test.js b/test/basic.csr.test.js
index 9ad0c0d97b..3840b95b10 100644
--- a/test/basic.csr.test.js
+++ b/test/basic.csr.test.js
@@ -147,6 +147,13 @@ test('/no-ssr', async t => {
t.is(await page.$text('h1'), 'Displayed only on client-side')
})
+test('/meta', async t => {
+ await page.nuxt.navigate('/meta', true)
+
+ const state = await page.nuxt.storeState()
+ t.deepEqual(state.meta, [{ works: true }])
+})
+
// Close server and ask nuxt to stop listening to file changes
test.after('Closing server and nuxt.js', t => {
nuxt.close()
diff --git a/test/basic.ssr.test.js b/test/basic.ssr.test.js
index 88fe599f45..c487581f4f 100755
--- a/test/basic.ssr.test.js
+++ b/test/basic.ssr.test.js
@@ -198,6 +198,12 @@ test('/_nuxt/ should return 404', async t => {
t.is(err.statusCode, 404)
})
+test('/meta', async t => {
+ const { html } = await nuxt.renderRoute('/meta')
+
+ t.true(html.includes('"meta":[{"works":true}]'))
+})
+
// Close server and ask nuxt to stop listening to file changes
test.after('Closing server and nuxt.js', t => {
nuxt.close()
diff --git a/test/fixtures/basic/middleware/meta.js b/test/fixtures/basic/middleware/meta.js
new file mode 100644
index 0000000000..c438131406
--- /dev/null
+++ b/test/fixtures/basic/middleware/meta.js
@@ -0,0 +1,3 @@
+export default ({ store, route, redirect }) => {
+ store.commit('setMeta', route.meta)
+}
diff --git a/test/fixtures/basic/pages/meta.vue b/test/fixtures/basic/pages/meta.vue
new file mode 100644
index 0000000000..4649b02390
--- /dev/null
+++ b/test/fixtures/basic/pages/meta.vue
@@ -0,0 +1,12 @@
+
+ {{ $store.state.meta }}
+
+
+
diff --git a/test/fixtures/basic/store/index.js b/test/fixtures/basic/store/index.js
index 5c1372507f..8052bed3ad 100755
--- a/test/fixtures/basic/store/index.js
+++ b/test/fixtures/basic/store/index.js
@@ -1,9 +1,13 @@
export const state = () => ({
- counter: 1
+ counter: 1,
+ meta: []
})
export const mutations = {
increment(state) {
state.counter++
+ },
+ setMeta(state, meta) {
+ state.meta = meta
}
}
diff --git a/test/helpers/browser.js b/test/helpers/browser.js
index b26ea5e35a..fdde550d93 100644
--- a/test/helpers/browser.js
+++ b/test/helpers/browser.js
@@ -47,6 +47,9 @@ export async function page(url) {
errorData() {
return page.evaluate(($nuxt) => $nuxt.nuxt.err, page.$nuxt)
},
+ storeState() {
+ return page.evaluate(($nuxt) => $nuxt.$store.state, page.$nuxt)
+ },
waitForNavigation() {
return page.waitForFunction('window.$nuxt.$loading.$data.show === false')
}