mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-05 03:47:12 +00:00
Modify /head test to fail with function based titleTemplate
This commit is contained in:
parent
f5acb6fc0e
commit
802778a54b
@ -13,7 +13,11 @@ let nuxt = null
|
|||||||
test.before('Init Nuxt.js', async t => {
|
test.before('Init Nuxt.js', async t => {
|
||||||
const options = {
|
const options = {
|
||||||
rootDir: resolve(__dirname, 'fixtures/basic'),
|
rootDir: resolve(__dirname, 'fixtures/basic'),
|
||||||
dev: false
|
dev: false,
|
||||||
|
head: {
|
||||||
|
titleTemplate: titleChunk => titleChunk ? `${titleChunk} - Nuxt.js` : 'Nuxt.js'
|
||||||
|
// titleTemplate: '%s - Nuxt.js'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nuxt = new Nuxt(options)
|
nuxt = new Nuxt(options)
|
||||||
await new Builder(nuxt).build()
|
await new Builder(nuxt).build()
|
||||||
@ -53,7 +57,7 @@ test('/head', async t => {
|
|||||||
const window = await nuxt.renderAndGetWindow(url('/head'), { virtualConsole: false })
|
const window = await nuxt.renderAndGetWindow(url('/head'), { virtualConsole: false })
|
||||||
const html = window.document.body.innerHTML
|
const html = window.document.body.innerHTML
|
||||||
const metas = window.document.getElementsByTagName('meta')
|
const metas = window.document.getElementsByTagName('meta')
|
||||||
t.is(window.document.title, 'My title')
|
t.is(window.document.title, 'My title - Nuxt.js')
|
||||||
t.is(metas[0].getAttribute('content'), 'my meta')
|
t.is(metas[0].getAttribute('content'), 'my meta')
|
||||||
t.true(html.includes('<div><h1>I can haz meta tags</h1></div>'))
|
t.true(html.includes('<div><h1>I can haz meta tags</h1></div>'))
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user