2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-14 20:42:24 +03:00

Add tests for expected behaviour

This commit is contained in:
Sean
2017-09-08 12:54:02 -07:00
parent c28ef2fae0
commit 7484adc70d
+60
View File
@@ -69,4 +69,64 @@ describe('getMetaInfo', () => {
__dangerouslyDisableSanitizers: []
})
})
it('properly uses string titleTemplates', () => {
component = new Vue({
metaInfo: {
title: 'Hello',
titleTemplate: '%s World',
meta: [
{ charset: 'utf-8' }
]
}
})
expect(getMetaInfo(component)).to.eql({
title: 'Hello World',
titleChunk: 'Hello',
titleTemplate: '%s World',
htmlAttrs: {},
headAttrs: {},
bodyAttrs: {},
meta: [
{ charset: 'utf-8' }
],
base: [],
link: [],
style: [],
script: [],
noscript: [],
__dangerouslyDisableSanitizers: []
})
})
it('properly uses function titleTemplates', () => {
const titleTemplate = chunk => `${chunk} Function World`
component = new Vue({
metaInfo: {
title: 'Hello',
titleTemplate: titleTemplate,
meta: [
{ charset: 'utf-8' }
]
}
})
expect(getMetaInfo(component)).to.eql({
title: 'Hello Function World',
titleChunk: 'Hello',
titleTemplate: titleTemplate,
htmlAttrs: {},
headAttrs: {},
bodyAttrs: {},
meta: [
{ charset: 'utf-8' }
],
base: [],
link: [],
style: [],
script: [],
noscript: [],
__dangerouslyDisableSanitizers: []
})
})
})