From 184bd01b2b7aecc8e3a866d008889b078c8e9c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Fri, 24 Mar 2017 18:35:30 +0100 Subject: [PATCH] Coverage for template and publicPath --- test/fixtures/with-config/app.html | 10 ++++++++++ test/fixtures/with-config/nuxt.config.js | 6 +++++- test/fixtures/with-config/plugins/only-client.js | 1 + test/with-config.test.js | 10 ++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/with-config/app.html create mode 100644 test/fixtures/with-config/plugins/only-client.js diff --git a/test/fixtures/with-config/app.html b/test/fixtures/with-config/app.html new file mode 100644 index 0000000000..86e25a09a2 --- /dev/null +++ b/test/fixtures/with-config/app.html @@ -0,0 +1,10 @@ + + + + {{ HEAD }} + + + {{ APP }} +

Made by Nuxt.js team

+ + diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 41cf46a770..73780c0666 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -10,7 +10,10 @@ module.exports = { } }, cache: true, - plugins: ['~plugins/test.js'], + plugins: [ + '~plugins/test.js', + { src: '~plugins/only-client.js', ssr: false } + ], loading: '~components/loading', env: { bool: true, @@ -18,6 +21,7 @@ module.exports = { string: 'Nuxt.js' }, build: { + publicPath: '/orion/', analyze: { analyzerMode: 'disabled', generateStatsFile: true diff --git a/test/fixtures/with-config/plugins/only-client.js b/test/fixtures/with-config/plugins/only-client.js new file mode 100644 index 0000000000..12ee6becab --- /dev/null +++ b/test/fixtures/with-config/plugins/only-client.js @@ -0,0 +1 @@ +console.log('Only called in client-side!') diff --git a/test/with-config.test.js b/test/with-config.test.js index 754f92c0d3..13b50b7452 100644 --- a/test/with-config.test.js +++ b/test/with-config.test.js @@ -24,6 +24,16 @@ test('/', async t => { t.true(html.includes('

I have custom configurations

')) }) +test('/ (custom app.html)', async t => { + const { html } = await nuxt.renderRoute('/') + t.true(html.includes('

Made by Nuxt.js team

')) +}) + +test('/ (custom build.publicPath)', async t => { + const { html } = await nuxt.renderRoute('/') + t.true(html.includes('src="/test/orion/vendor.bundle')) +}) + test('/test/ (router base)', async t => { const window = await nuxt.renderAndGetWindow(url('/test/')) const html = window.document.body.innerHTML