Skip to content

Commit 184bd01

Browse files
committed
Coverage for template and publicPath
1 parent 954c25b commit 184bd01

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

test/fixtures/with-config/app.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html {{ HTML_ATTRS }}>
3+
<head>
4+
{{ HEAD }}
5+
</head>
6+
<body {{ BODY_ATTRS }}>
7+
{{ APP }}
8+
<p>Made by Nuxt.js team</p>
9+
</body>
10+
</html>

test/fixtures/with-config/nuxt.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ module.exports = {
1010
}
1111
},
1212
cache: true,
13-
plugins: ['~plugins/test.js'],
13+
plugins: [
14+
'~plugins/test.js',
15+
{ src: '~plugins/only-client.js', ssr: false }
16+
],
1417
loading: '~components/loading',
1518
env: {
1619
bool: true,
1720
num: 23,
1821
string: 'Nuxt.js'
1922
},
2023
build: {
24+
publicPath: '/orion/',
2125
analyze: {
2226
analyzerMode: 'disabled',
2327
generateStatsFile: true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Only called in client-side!')

test/with-config.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ test('/', async t => {
2424
t.true(html.includes('<h1>I have custom configurations</h1>'))
2525
})
2626

27+
test('/ (custom app.html)', async t => {
28+
const { html } = await nuxt.renderRoute('/')
29+
t.true(html.includes('<p>Made by Nuxt.js team</p>'))
30+
})
31+
32+
test('/ (custom build.publicPath)', async t => {
33+
const { html } = await nuxt.renderRoute('/')
34+
t.true(html.includes('src="/test/orion/vendor.bundle'))
35+
})
36+
2737
test('/test/ (router base)', async t => {
2838
const window = await nuxt.renderAndGetWindow(url('/test/'))
2939
const html = window.document.body.innerHTML

0 commit comments

Comments
 (0)