fix(editor): plurals, trimmed names, default tab, parent drawing confirmation

This commit is contained in:
bchanot committed 2026-11-04 19:40:43 +01:00
1 parent b42c6ae844
commit be4f468790
35 files changed
+385 -63

No files matched your search

@@ -0,0 +1,41 @@
/** N1 (C40): the tab a version opens on. */
import { afterEach, describe, expect, it, vi } from 'vitest'
import { initialTab } from '@/editor/tabs'
import { emptyText } from '../helpers/editorFixtures'
import {
baseText,
openReady,
resetStore,
store,
} from '../helpers/editorHarness'
vi.mock('@/lib/supabase', () => ({ getSupabaseClient: () => ({}) }))
vi.mock('@faunosteo/supabase', async (orig) => ({
...(await orig<typeof import('@faunosteo/supabase')>()),
getSheetVersion: vi.fn(),
downloadSheetDrawing: vi.fn(),
saveSheetDraft: vi.fn(),
getOfficialSheetAdmin: vi.fn(),
submitSheetReview: vi.fn(),
}))
afterEach(resetStore)
async function stateOf(text: string) {
await openReady({ text })
return store.getState().previewState!
}
describe('initialTab', () => {
it('opens an empty new draft on Général', async () => {
expect(initialTab(await stateOf(emptyText()), 'wide')).toBe('general')
})
it('opens a draft with a measured view on Annotations', async () => {
expect(initialTab(await stateOf(baseText()), 'wide')).toBe('annotations')
})
it('keeps Annotations on a tier that does not list Général', async () => {
expect(initialTab(await stateOf(emptyText()), 'small')).toBe('annotations')
})
})