feat: article editor core

This commit is contained in:
fsylvain committed 2026-09-27 02:11:38 +02:00
1 parent d493a181e1
commit a4734b2c91
55 files changed
+4186 -496

No files matched your search

+22 -7
View File
@@ -65,7 +65,10 @@ describe('Nuxt UI shell foundation and router guards', () => {
it('The first navigation to a non-public route resolves the session and shows AppBoot meanwhile', async () => {
let resolveMe: (value: { verified: boolean }) => void = () => {}
const getMe = vi.fn(
() => new Promise<{ verified: boolean }>((resolve) => (resolveMe = resolve)),
() =>
new Promise<{ verified: boolean }>(
(resolve) => (resolveMe = resolve),
),
)
vi.mocked(useApi).mockReturnValue({ getMe })
setUpSession()
@@ -121,7 +124,9 @@ describe('Nuxt UI shell foundation and router guards', () => {
await router.push('/article')
mountApp()
await vi.waitFor(() => expect(router.currentRoute.value.path).toBe('/register/pending'))
await vi.waitFor(() =>
expect(router.currentRoute.value.path).toBe('/register/pending'),
)
})
it('A session-only route admits an unverified session', async () => {
@@ -196,7 +201,9 @@ describe('Nuxt UI shell foundation and router guards', () => {
)
expect(app.text()).toContain('Home')
const primaryButton = app.findAll('button').find((button) => button.text() === 'Try again')
const primaryButton = app
.findAll('button')
.find((button) => button.text() === 'Try again')
await primaryButton?.trigger('click')
await flushPromises()
@@ -212,12 +219,16 @@ describe('Nuxt UI shell foundation and router guards', () => {
const app = mountApp()
await vi.waitFor(() =>
expect(app.find('[role="alert"] h1').text()).toBe('Something went wrong'),
expect(app.find('[role="alert"] h1').text()).toBe(
'Something went wrong',
),
)
expect(router.currentRoute.value.path).toBe('/article')
const primaryButton = app.findAll('button').find((button) => button.text() === 'Try again')
const primaryButton = app
.findAll('button')
.find((button) => button.text() === 'Try again')
await primaryButton?.trigger('click')
await flushPromises()
@@ -240,10 +251,14 @@ describe('Nuxt UI shell foundation and router guards', () => {
await flushPromises()
const headings = app.findAll('h1')
expect(headings.some((heading) => heading.text() === title)).toBe(true)
expect(headings.some((heading) => heading.text() === title)).toBe(
true,
)
expect(app.find('nav[aria-label="breadcrumb"]').text()).toBe(title)
const activeLink = app.find(`a[href="${path}"][aria-current="page"]`)
const activeLink = app.find(
`a[href="${path}"][aria-current="page"]`,
)
expect(activeLink.exists()).toBe(true)
},
)