feat: wire global runtime injection and playground

This commit is contained in:
stanig2106
2025-11-14 06:15:33 +01:00
parent 534bc39197
commit f12bc0ce85
18 changed files with 516 additions and 54 deletions

View File

@@ -7,9 +7,23 @@ describe('ssr', async () => {
rootDir: fileURLToPath(new URL('./fixtures/basic', import.meta.url)),
})
it('renders the index page', async () => {
// Get response to a server-rendered page with `$fetch`.
it('renders the allowed branches when permissions pass', async () => {
const html = await $fetch('/')
expect(html).toContain('<div>basic</div>')
expect(html).toContain('<h1>basic</h1>')
expect(html).toContain('id="can-view"')
expect(html).toContain('id="can-edit"')
expect(html).toContain('Creation contrat')
})
it('falls back to the `v-cannot` branch when the permission is missing', async () => {
const html = await $fetch('/')
expect(html).not.toContain('id="can-delete"')
expect(html).toContain('id="cannot-delete"')
expect(html).toContain('Suppression interdite')
})
it('exposes the can proxy globally for template usage', async () => {
const html = await $fetch('/')
expect(html).toMatch(/id="path-display"[\s\S]*employee\.view/)
})
})