2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-20 04:50:34 +03:00

feat: child can indicate its content should be ignored (resolves: #204)

This commit is contained in:
pimlie
2019-03-08 14:41:11 +01:00
committed by Alexander Lichter
parent 4dafffea4e
commit 22e456cbe2
2 changed files with 77 additions and 2 deletions
+54
View File
@@ -617,4 +617,58 @@ describe('getMetaInfo', () => {
__dangerouslyDisableSanitizersByTagID: {}
})
})
test('child can indicate its content should be ignored', () => {
Vue.component('merge-child', {
render: h => h('div'),
metaInfo: {
title: false,
meta: [
{
vmid: 'og:title',
content: false
}
]
}
})
const component = new Vue({
metaInfo: {
title: 'Hello',
meta: [
{
vmid: 'og:title',
property: 'og:title',
content: 'Test title',
template: chunk => `${chunk} - My page`
}
]
},
el: document.createElement('div'),
render: h => h('div', null, [h('merge-child')])
})
expect(getMetaInfo(component)).toEqual({
title: 'Hello',
titleChunk: 'Hello',
titleTemplate: '%s',
htmlAttrs: {},
headAttrs: {},
bodyAttrs: {},
meta: [
{
vmid: 'og:title',
property: 'og:title',
content: 'Test title - My page'
}
],
base: [],
link: [],
style: [],
script: [],
noscript: [],
__dangerouslyDisableSanitizers: [],
__dangerouslyDisableSanitizersByTagID: {}
})
})
})