feat: roles SPA foundations

This commit is contained in:
Florian Sylvain committed 2026-10-27 22:21:12 +01:00
1 parent 80f7037d3a
commit 907949aa12
180 files changed
+4308 -835

No files matched your search

+6 -7
View File
@@ -321,21 +321,20 @@ describe.each([
})
describe('Sites SEO defaults: sessions', () => {
it('shows the owner-only toast when the PATCH answers 403', async () => {
it('shows no owner-only toast of its own when the PATCH answers 403 missing_permission', async () => {
const backend = createBackend()
backend.responders['PATCH /v1/site/1'] = failWith(403, 'owner_only')
backend.responders['PATCH /v1/site/1'] = failWith(403, 'missing_permission')
await openEdit('Renew', backend)
await typeInto(templateField(), '%title% – %site%')
await submit()
expect(document.body.textContent).toContain('Only the owner can manage sites')
expect(document.body.textContent).toContain('Ask the owner of this site.')
expect(document.body.textContent).not.toContain('Only the owner can manage sites')
})
it('shows the 403 page to an admin', async () => {
await mountDirectory('sites', '/settings/sites', { role: 'admin' })
it('shows the 403 page to a writer', async () => {
await mountDirectory('sites', '/settings/sites', { role: 'member' })
expect(document.body.textContent).toContain("You don't have access to Sites")
expect(document.body.textContent).toContain("You don't have access to this page")
expect(document.body.textContent).not.toContain('Title template')
expect(vi.mocked(useApi)).toHaveBeenCalled()
})