mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
Add test for extendRoutes
This commit is contained in:
parent
be6562f244
commit
f8735dc450
11
test/fixtures/with-config/nuxt.config.js
vendored
11
test/fixtures/with-config/nuxt.config.js
vendored
@ -1,6 +1,15 @@
|
|||||||
|
const resolve = require('path').resolve
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
router: {
|
router: {
|
||||||
base: '/test/'
|
base: '/test/',
|
||||||
|
extendRoutes (routes) {
|
||||||
|
routes.push({
|
||||||
|
name: 'about-bis',
|
||||||
|
path: '/about-bis',
|
||||||
|
component: resolve(__dirname, 'pages/about.vue')
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
cache: true,
|
cache: true,
|
||||||
plugins: ['~plugins/test.js'],
|
plugins: ['~plugins/test.js'],
|
||||||
|
@ -47,6 +47,13 @@ test('/test/env', async t => {
|
|||||||
t.true(html.includes('"string": "Nuxt.js"'))
|
t.true(html.includes('"string": "Nuxt.js"'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('/test/about-bis (added with extendRoutes)', async t => {
|
||||||
|
const window = await nuxt.renderAndGetWindow(url('/test/about-bis'))
|
||||||
|
const html = window.document.body.innerHTML
|
||||||
|
t.true(html.includes('<h1>Custom layout</h1>'))
|
||||||
|
t.true(html.includes('<h1>About page</h1>'))
|
||||||
|
})
|
||||||
|
|
||||||
// Close server and ask nuxt to stop listening to file changes
|
// Close server and ask nuxt to stop listening to file changes
|
||||||
test.after('Closing server and nuxt.js', t => {
|
test.after('Closing server and nuxt.js', t => {
|
||||||
server.close()
|
server.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user