From 15400e1828c2152a559bcf906c21892df520ffd3 Mon Sep 17 00:00:00 2001 From: Sebastien Chopin Date: Thu, 27 Jul 2017 16:50:24 +0200 Subject: [PATCH] Add test for custom state --- test/basic.test.js | 5 +++++ test/fixtures/basic/pages/special-state.vue | 15 +++++++++++++++ test/fixtures/with-config/nuxt.config.js | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/basic/pages/special-state.vue diff --git a/test/basic.test.js b/test/basic.test.js index 93a0e07c5b..42063c9219 100755 --- a/test/basic.test.js +++ b/test/basic.test.js @@ -101,6 +101,11 @@ test('/redirect -> check redirected source', async t => { t.true(html.includes('

Index page

')) }) +test.only('/special-state -> check window.__NUXT__.test = true', async t => { + const window = await nuxt.renderAndGetWindow(url('/special-state')) + t.is(window.__NUXT__.test, true) +}) + test('/error', async t => { try { await nuxt.renderRoute('/error', { req: {}, res: {} }) diff --git a/test/fixtures/basic/pages/special-state.vue b/test/fixtures/basic/pages/special-state.vue new file mode 100644 index 0000000000..5e4fc7a989 --- /dev/null +++ b/test/fixtures/basic/pages/special-state.vue @@ -0,0 +1,15 @@ + + + diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 339e770469..f13748f4e1 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -14,7 +14,7 @@ module.exports = { transition: 'test', offline: true, plugins: [ - '~/plugins/test.js', // Use ~ for deprication warning coverage + '~/plugins/test.js', { src: '~/plugins/only-client.js', ssr: false } ], loading: '~/components/loading',