2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-19 07:40:33 +03:00

fix: only show boolean attrs with truthy value

This commit is contained in:
pimlie
2019-07-11 20:56:34 +02:00
parent 39d9eb6ead
commit 1d9072a3af
5 changed files with 49 additions and 6 deletions
+31
View File
@@ -71,4 +71,35 @@ describe('escaping', () => {
__dangerouslyDisableSanitizersByTagID: { noscape: ['innerHTML'] }
})
})
test.skip('special chars are escaped unless disabled by vmid', () => {
const component = new Vue({
metaInfo: {
title: 'Hello',
script: [
{ vmid: 'yescape', innerHTML: ['12', 'asd'] }
]
}
})
expect(getMetaInfo(component, [[/&/g, '&']])).toEqual({
title: 'Hello',
titleChunk: 'Hello',
titleTemplate: '%s',
htmlAttrs: {},
headAttrs: {},
bodyAttrs: {},
meta: [],
base: [],
link: [],
style: [],
script: [
{ innerHTML: 'Hello & Goodbye', vmid: 'yescape' },
{ innerHTML: 'Hello & Goodbye', vmid: 'noscape' }
],
noscript: [],
__dangerouslyDisableSanitizers: [],
__dangerouslyDisableSanitizersByTagID: { noscape: ['innerHTML'] }
})
})
})