fix(app): editor route split into dialogs and pickers components, canvas without lint suppression, findings picker coverage restored; golden test pins every generated draft file; stale doc lines
This commit is contained in:
1 parent
0476276a8f
commit
09d8b01a54
11 files changed
+374
-161
No files matched your search
@@ -109,4 +109,116 @@ describe('FindingsTreePicker on a sheet finding zone', () => {
|
||||
}),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('flags a vet-referral leaf and omits the key on other leaves', async () => {
|
||||
const user = userEvent.setup()
|
||||
const onChange = vi.fn()
|
||||
render(
|
||||
<FindingsTreePicker
|
||||
zone={sheet.findingZone('hip')!}
|
||||
selected={[]}
|
||||
onChange={onChange}
|
||||
/>,
|
||||
)
|
||||
await user.click(
|
||||
screen.getByRole('button', {
|
||||
name: 'Ouvrir Dysfonctions ostéopathiques',
|
||||
}),
|
||||
)
|
||||
await user.click(
|
||||
screen.getByRole('button', {
|
||||
name: 'Ouvrir Restrictions de mobilité articulaire',
|
||||
}),
|
||||
)
|
||||
await user.click(
|
||||
screen.getByRole('checkbox', { name: 'Hypermobilité / laxité perçue' }),
|
||||
)
|
||||
expect(onChange.mock.calls[0]![0][0].requiresVetReferral).toBe(true)
|
||||
onChange.mockClear()
|
||||
await user.click(
|
||||
screen.getByRole('checkbox', { name: 'Hypomobilité globale' }),
|
||||
)
|
||||
expect(onChange.mock.calls[0]![0][0]).not.toHaveProperty(
|
||||
'requiresVetReferral',
|
||||
)
|
||||
})
|
||||
|
||||
describe('count badges and scoping', () => {
|
||||
const finding = (
|
||||
path: string[],
|
||||
extra: Partial<Finding> = {},
|
||||
): Finding => ({
|
||||
findingZoneId: 'hip',
|
||||
path,
|
||||
labelFrSnapshot: 'x',
|
||||
labelEnSnapshot: 'x',
|
||||
side: 'left',
|
||||
...extra,
|
||||
})
|
||||
const base = [
|
||||
finding(['hip-dysfunctions', 'articular', 'hypomobility']),
|
||||
finding(['hip-dysfunctions', 'articular', 'hypermobility']),
|
||||
finding(['hip-dysfunctions', 'muscular', 'trigger-points']),
|
||||
]
|
||||
|
||||
function renderPicker(selected: Finding[]) {
|
||||
render(
|
||||
<FindingsTreePicker
|
||||
zone={sheet.findingZone('hip')!}
|
||||
side="left"
|
||||
selected={selected}
|
||||
onChange={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
}
|
||||
|
||||
it('counts selected findings per level, none on a clean sibling', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderPicker(base)
|
||||
expect(
|
||||
screen.getByLabelText('3 constats sélectionnés'),
|
||||
).toBeInTheDocument()
|
||||
expect(screen.getAllByLabelText(/constats? sélectionnés?$/)).toHaveLength(
|
||||
1,
|
||||
)
|
||||
await user.click(
|
||||
screen.getByRole('button', {
|
||||
name: 'Ouvrir Dysfonctions ostéopathiques',
|
||||
}),
|
||||
)
|
||||
expect(
|
||||
screen.getByLabelText('2 constats sélectionnés'),
|
||||
).toBeInTheDocument()
|
||||
expect(screen.getByLabelText('1 constat sélectionné')).toBeInTheDocument()
|
||||
expect(screen.getAllByLabelText(/constats? sélectionnés?$/)).toHaveLength(
|
||||
2,
|
||||
)
|
||||
})
|
||||
|
||||
it('ignores findings of another zone or another side', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderPicker([
|
||||
finding(['hip-dysfunctions', 'articular', 'hypomobility'], {
|
||||
findingZoneId: 'stifle',
|
||||
}),
|
||||
finding(['hip-dysfunctions', 'articular', 'hypomobility'], {
|
||||
side: 'right',
|
||||
}),
|
||||
])
|
||||
expect(screen.queryByLabelText(/sélectionnés?$/)).toBeNull()
|
||||
await user.click(
|
||||
screen.getByRole('button', {
|
||||
name: 'Ouvrir Dysfonctions ostéopathiques',
|
||||
}),
|
||||
)
|
||||
await user.click(
|
||||
screen.getByRole('button', {
|
||||
name: 'Ouvrir Restrictions de mobilité articulaire',
|
||||
}),
|
||||
)
|
||||
expect(
|
||||
screen.getByRole('checkbox', { name: 'Hypomobilité globale' }),
|
||||
).not.toBeChecked()
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user