Remove JS files for pages & layouts

This commit is contained in:
Sebastien Chopin 2017-08-17 15:23:40 +02:00
parent e3eb83d669
commit af60ba21c0
8 changed files with 5 additions and 43 deletions

View File

@ -1,7 +1,7 @@
export default {
render (h) {
return <div>
<h1>Welcome!</h1>
<h1>Welcome !</h1>
<nuxt-link to="/about">About page</nuxt-link>
</div>
}

View File

@ -73,6 +73,7 @@ export function getContext (context, app) {
let ctx = {
isServer: !!context.isServer,
isClient: !!context.isClient,
isStatic: process.static,
isDev: <%= isDev %>,
app: app,
<%= (store ? 'store: context.store,' : '') %>

View File

@ -190,7 +190,7 @@ export function cleanChildrenRoutes (routes, isChild = false) {
export function createRoutes (files, srcDir) {
let routes = []
files.forEach((file) => {
let keys = file.replace(/^pages/, '').replace(/\.(vue|js)$/, '').replace(/\/{2,}/g, '/').split('/').slice(1)
let keys = file.replace(/^pages/, '').replace(/\.vue$/, '').replace(/\/{2,}/g, '/').split('/').slice(1)
let route = { name: '', path: '', component: r(srcDir, file) }
let parent = routes
keys.forEach((key, i) => {

View File

@ -26,11 +26,6 @@ test('/stateless', async t => {
t.true(html.includes('<h1>My component!</h1>'))
})
test('/jsfile', async t => {
const { html } = await nuxt.renderRoute('/jsfile')
t.true(html.includes('<span>support js pages</span>'))
})
/*
** Example of testing via dom checking
*/

View File

@ -1,5 +0,0 @@
export default {
render (h) {
return h('span', ['support js pages'])
}
}

View File

@ -1,10 +0,0 @@
export default {
render () {
return (
<div>
<h1>JS layout</h1>
<nuxt/>
</div>
)
}
}

View File

@ -1,11 +0,0 @@
export default {
layout: 'js',
render () {
return (
<div>
<h1>About JS page</h1>
<nuxt-link to="/">Home page</nuxt-link>
</div>
)
}
}

View File

@ -38,7 +38,7 @@ test('/ (custom app.html)', async t => {
test('/ (custom build.publicPath)', async t => {
const { html } = await nuxt.renderRoute('/')
t.true(html.includes('src="/test/orion/vendor.bundle'))
t.true(html.includes('src="/test/orion/vendor.'))
})
test('/test/ (router base)', async t => {
@ -57,14 +57,6 @@ test('/test/about (custom layout)', async t => {
t.true(html.includes('<h1>About page</h1>'))
})
test('/test/js (custom js layout)', async t => {
const window = await nuxt.renderAndGetWindow(url('/test/js'))
const html = window.document.body.innerHTML
t.is(window.__NUXT__.layout, 'js')
t.true(html.includes('<h1>JS layout</h1>'))
t.true(html.includes('<h1>About JS page</h1>'))
})
test('/test/env', async t => {
const window = await nuxt.renderAndGetWindow(url('/test/env'))
const html = window.document.body.innerHTML
@ -95,7 +87,7 @@ test('/test/about-bis (added with extendRoutes)', async t => {
test('Check stats.json generated by build.analyze', t => {
const stats = require(resolve(__dirname, 'fixtures/with-config/.nuxt/dist/stats.json'))
t.is(stats.assets.length, 31)
t.is(stats.assets.length, 27)
})
test('Check /test.txt with custom serve-static options', async t => {