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

@@ -150,6 +150,36 @@ describe('Vues et illustrations: drawing states', () => {
expect(screen.queryByText(/introuvable/)).toBeNull()
})
it('use-parent asks first: cancel changes nothing, confirm commits once, undo restores', async () => {
const own = detail()
;(own.value as { svg_asset_id: string | null }).svg_asset_id = ASSET
await openReady({ text: insert(baseText(), own) })
const user = userEvent.setup()
render(<ViewsTab {...props} />)
const open = () =>
user.click(
screen.getByRole('button', {
name: "Utiliser l'illustration de la vue parente",
}),
)
await open()
const dialog = screen.getByRole('dialog')
expect(dialog).toHaveTextContent(/reste enregistré/)
await user.click(within(dialog).getByRole('button', { name: 'Annuler' }))
expect(doc().views[1]).toMatchObject({ svg_asset_id: ASSET })
expect(store.getState().undo).toHaveLength(0)
await open()
await user.click(
within(screen.getByRole('dialog')).getByRole('button', {
name: "Utiliser l'illustration parente",
}),
)
expect(doc().views[1]).toMatchObject({ svg_asset_id: null })
expect(store.getState().undo).toHaveLength(1)
store.getState().undoStep()
expect(doc().views[1]).toMatchObject({ svg_asset_id: ASSET })
})
it('read-only shows states as text and no action', async () => {
await openReady({ text: insert(baseText(), detail()) })
render(<ViewsTab {...props} readOnly />)