Coverage for template and publicPath

This commit is contained in:
Sébastien Chopin 2017-03-24 18:35:30 +01:00
parent 954c25b420
commit 184bd01b2b
4 changed files with 26 additions and 1 deletions

10
test/fixtures/with-config/app.html vendored Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<head>
{{ HEAD }}
</head>
<body {{ BODY_ATTRS }}>
{{ APP }}
<p>Made by Nuxt.js team</p>
</body>
</html>

View File

@ -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

View File

@ -0,0 +1 @@
console.log('Only called in client-side!')

View File

@ -24,6 +24,16 @@ test('/', async t => {
t.true(html.includes('<h1>I have custom configurations</h1>'))
})
test('/ (custom app.html)', async t => {
const { html } = await nuxt.renderRoute('/')
t.true(html.includes('<p>Made by Nuxt.js team</p>'))
})
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