mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-05-31 07:34:05 +03:00
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
import _getMetaInfo from '../src/shared/getMetaInfo'
|
|
import { defaultOptions, loadVueMetaPlugin } from './utils'
|
|
|
|
const getMetaInfo = (component, escapeSequences) => _getMetaInfo(defaultOptions, component, escapeSequences)
|
|
|
|
describe('escaping', () => {
|
|
let Vue
|
|
|
|
beforeAll(() => (Vue = loadVueMetaPlugin()))
|
|
|
|
test('special chars are escaped unless disabled', () => {
|
|
const component = new Vue({
|
|
metaInfo: {
|
|
title: 'Hello & Goodbye',
|
|
script: [{ innerHTML: 'Hello & Goodbye' }],
|
|
__dangerouslyDisableSanitizers: ['script']
|
|
}
|
|
})
|
|
|
|
expect(getMetaInfo(component, [[/&/g, '&']])).toEqual({
|
|
title: 'Hello & Goodbye',
|
|
titleChunk: 'Hello & Goodbye',
|
|
titleTemplate: '%s',
|
|
htmlAttrs: {},
|
|
headAttrs: {},
|
|
bodyAttrs: {},
|
|
meta: [],
|
|
base: [],
|
|
link: [],
|
|
style: [],
|
|
script: [{ innerHTML: 'Hello & Goodbye' }],
|
|
noscript: [],
|
|
__dangerouslyDisableSanitizers: ['script'],
|
|
__dangerouslyDisableSanitizersByTagID: {}
|
|
})
|
|
})
|
|
})
|