mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
test: rename custom-pages to custom-dirs and include tests for assets
This commit is contained in:
parent
fb29df43fd
commit
ba5e608302
@ -8,7 +8,7 @@ let builder = null
|
||||
|
||||
// Init nuxt.js and create server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async t => {
|
||||
const rootDir = resolve(__dirname, 'fixtures/custom-pages-dir')
|
||||
const rootDir = resolve(__dirname, 'fixtures/custom-dirs')
|
||||
let config = require(resolve(rootDir, 'nuxt.config.js'))
|
||||
config.rootDir = rootDir
|
||||
config.dev = false
|
||||
@ -24,11 +24,16 @@ test.before('Init Nuxt.js', async t => {
|
||||
t.true(logSpy.calledWithMatch('OPEN'))
|
||||
})
|
||||
|
||||
test('/', async t => {
|
||||
test('/ (custom pages directory)', async t => {
|
||||
const { html } = await nuxt.renderRoute('/')
|
||||
t.true(html.includes('<h1>I have custom pages directory</h1>'))
|
||||
})
|
||||
|
||||
test('/ (custom assets directory)', async t => {
|
||||
const { html } = await nuxt.renderRoute('/')
|
||||
t.true(html.includes('.global-css-selector'))
|
||||
})
|
||||
|
||||
// Close server and ask nuxt to stop listening to file changes
|
||||
test.after.always('Closing server and nuxt.js', async t => {
|
||||
await nuxt.close()
|
3
test/fixtures/custom-dirs/custom-assets/app.css
vendored
Normal file
3
test/fixtures/custom-dirs/custom-assets/app.css
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.global-css-selector {
|
||||
color: red;
|
||||
}
|
5
test/fixtures/custom-dirs/nuxt.config.js
vendored
Normal file
5
test/fixtures/custom-dirs/nuxt.config.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
assetsDir: 'custom-assets',
|
||||
pagesDir: 'custom-pages',
|
||||
css: [{ src: '~/custom-assets/app.css' }]
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "custom-pages-dir",
|
||||
"name": "custom-dirs",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
module.exports = {
|
||||
pagesDir: 'custom-pages'
|
||||
}
|
Loading…
Reference in New Issue
Block a user