feat(editor): repair out-of-frame annotations when attaching a drawing
This commit is contained in:
1 parent
4ab85adeb0
commit
3776a33b79
22 files changed
+1277
-19
No files matched your search
@@ -6,6 +6,7 @@ import type {
|
||||
AnatomicalSheetDocument,
|
||||
FindingNode,
|
||||
} from '@faunosteo/core-wasm/types'
|
||||
import FindingCreateForm from '@/components/editor/findings/FindingCreateForm'
|
||||
import FindingsTab from '@/components/editor/tabs/FindingsTab'
|
||||
import { buildItems, keyMove, visibleItems } from '@/editor/findings/tree'
|
||||
import { useLocaleStore } from '@/state/localeStore'
|
||||
@@ -527,3 +528,36 @@ describe('Constats tab', () => {
|
||||
expect(items()[0]).toHaveFocus()
|
||||
})
|
||||
})
|
||||
|
||||
describe('the category form title (N1 review)', () => {
|
||||
const parentOf = (id: string) => {
|
||||
const found = buildItems(doc()).find((item) => item.id.includes(`"${id}"`) && item.path.at(-1) === id || item.zoneId === id && item.kind === 'zone')
|
||||
if (!found) throw new Error(`no ${id}`)
|
||||
return found
|
||||
}
|
||||
const title = (parent: ReturnType<typeof parentOf> | null) => {
|
||||
render(
|
||||
<FindingCreateForm
|
||||
pending={{ kind: 'category', parent }}
|
||||
onCreated={vi.fn()}
|
||||
onCancel={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
return document.querySelector('p.font-medium')?.textContent
|
||||
}
|
||||
|
||||
it.each(['zone-a', 'fcat-a', 'node-a'])(
|
||||
'names the zone when the parent is %s',
|
||||
async (id) => {
|
||||
await openReady({ text: treeText() })
|
||||
expect(title(parentOf(id))).toBe(
|
||||
'Nouvelle catégorie dans la zone « Zone A »',
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
it('falls back to an existing label, never a missing key, without a parent', async () => {
|
||||
await openReady({ text: treeText() })
|
||||
expect(title(null)).toBe('Ajouter une catégorie')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user