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

fix: add warning for v1 boolean attribute syntax

This commit is contained in:
pimlie
2019-06-22 16:50:23 +02:00
parent be5f1d0d55
commit bfeab1754e
2 changed files with 37 additions and 1 deletions
+32
View File
@@ -820,4 +820,36 @@ describe('getMetaInfo', () => {
__dangerouslyDisableSanitizersByTagID: {}
})
})
test.only('prints warning for boolean attributes with value undefined', () => {
const warn = jest.spyOn(console, 'warn').mockImplementation(() => {})
const component = new Vue({
metaInfo: {
htmlAttrs: {
amp: undefined
}
}
})
expect(getMetaInfo(component)).toEqual({
title: undefined,
titleChunk: '',
titleTemplate: '%s',
htmlAttrs: {},
headAttrs: {},
bodyAttrs: {},
meta: [],
base: [],
link: [],
style: [],
script: [],
noscript: [],
__dangerouslyDisableSanitizers: [],
__dangerouslyDisableSanitizersByTagID: {}
})
expect(warn).toHaveBeenCalledTimes(1)
expect(warn).toHaveBeenCalledWith(expect.stringMatching('the value undefined'))
})
})