mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-19 18:30:34 +03:00
feat: add option for prepending (no)script to body (#410)
* feat: add option for prepending (no)script to body * test: use browser getUrl * refactor: use pbody insteadn of pody * test: add prepend/append body generator test * test: add prepend body updater test * chore: remove typo
This commit is contained in:
@@ -81,4 +81,22 @@ describe('extra tests', () => {
|
||||
const bodyAttrs = generateServerInjector('bodyAttrs', {})
|
||||
expect(bodyAttrs.text(true)).toBe('')
|
||||
})
|
||||
|
||||
test('script prepend body', () => {
|
||||
const tags = [{ src: '/script.js', pbody: true }]
|
||||
const scriptTags = generateServerInjector('script', tags)
|
||||
|
||||
expect(scriptTags.text()).toBe('')
|
||||
expect(scriptTags.text({ body: true })).toBe('')
|
||||
expect(scriptTags.text({ pbody: true })).toBe('<script data-vue-meta="test" src="/script.js" data-pbody="true"></script>')
|
||||
})
|
||||
|
||||
test('script append body', () => {
|
||||
const tags = [{ src: '/script.js', body: true }]
|
||||
const scriptTags = generateServerInjector('script', tags)
|
||||
|
||||
expect(scriptTags.text()).toBe('')
|
||||
expect(scriptTags.text({ body: true })).toBe('<script data-vue-meta="test" src="/script.js" data-body="true"></script>')
|
||||
expect(scriptTags.text({ pbody: true })).toBe('')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user