2
0
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:
Pim
2019-07-17 22:26:33 +02:00
committed by GitHub
parent f90cd41e52
commit 05163a77a8
11 changed files with 150 additions and 62 deletions
+18
View File
@@ -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('')
})
})