mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-22 08:00:35 +03:00
fix: add warning for v1 boolean attribute syntax
This commit is contained in:
@@ -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'))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user