mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-20 08:30:33 +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:
@@ -67,14 +67,7 @@ describe(browserString, () => {
|
||||
})
|
||||
|
||||
test('open page', async () => {
|
||||
const webPath = '/index.html'
|
||||
|
||||
let url
|
||||
if (browser.getLocalFolderUrl) {
|
||||
url = browser.getLocalFolderUrl(webPath)
|
||||
} else {
|
||||
url = `file://${path.join(folder, webPath)}`
|
||||
}
|
||||
const url = browser.getUrl('/index.html')
|
||||
|
||||
page = await browser.page(url)
|
||||
|
||||
@@ -91,12 +84,16 @@ describe(browserString, () => {
|
||||
sanitizeCheck.push(...(await page.getTexts('noscript')))
|
||||
sanitizeCheck = sanitizeCheck.filter(v => !!v)
|
||||
|
||||
expect(sanitizeCheck.length).toBe(3)
|
||||
expect(sanitizeCheck.length).toBe(4)
|
||||
expect(() => JSON.parse(sanitizeCheck[0])).not.toThrow()
|
||||
// TODO: check why this doesnt Throw when Home is dynamic loaded
|
||||
// (but that causes hydration error)
|
||||
expect(() => JSON.parse(sanitizeCheck[1])).toThrow()
|
||||
expect(() => JSON.parse(sanitizeCheck[2])).not.toThrow()
|
||||
expect(() => JSON.parse(sanitizeCheck[3])).not.toThrow()
|
||||
|
||||
expect(await page.getElementCount('body noscript:first-child')).toBe(1)
|
||||
expect(await page.getElementCount('body noscript:last-child')).toBe(1)
|
||||
})
|
||||
|
||||
test('/about', async () => {
|
||||
|
||||
Reference in New Issue
Block a user