Files
ui/test/components/component-render.ts
Juho Rutila bcc46b87f5 test: add initial component tests (#923)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2023-11-17 10:49:43 +01:00

20 lines
536 B
TypeScript

import { mountSuspended } from 'nuxt-vitest/utils'
import path from 'path'
export default async function (nameOrHtml: string, options: any, component: any) {
let html
const name = path.parse(component.__file).name
if (options === undefined) {
const app = {
template: nameOrHtml,
components: { [`U${name}`]: component }
}
const result = await mountSuspended(app)
html = result.html()
} else {
const cResult = await mountSuspended(component, options)
html = cResult.html()
}
return html
}