diff --git a/src/components/observation/PathologyPicker.tsx b/src/components/observation/PathologyPicker.tsx
index 3e774284..4477b2f9 100644
--- a/src/components/observation/PathologyPicker.tsx
+++ b/src/components/observation/PathologyPicker.tsx
@@ -1,3 +1,65 @@
-export default function PathologyPicker() {
- return
PathologyPicker placeholder
+import { useMemo } from 'react'
+import type { Pathology } from '@/domain/schema/pathology'
+
+export interface PathologyPickerProps {
+ pool: Pathology[]
+ speciesId: string
+ boneIds: string[]
+ selected: string[]
+ onChange: (next: string[]) => void
+}
+
+function matches(p: Pathology, speciesId: string, boneIds: string[]): boolean {
+ const speciesOk = p.speciesIds.length === 0 || p.speciesIds.includes(speciesId)
+ if (!speciesOk) return false
+ if (boneIds.length === 0) return true
+ if (p.boneIds.length === 0) return true
+ return p.boneIds.some((b) => boneIds.includes(b))
+}
+
+export default function PathologyPicker({
+ pool,
+ speciesId,
+ boneIds,
+ selected,
+ onChange,
+}: PathologyPickerProps) {
+ const filtered = useMemo(
+ () => pool.filter((p) => matches(p, speciesId, boneIds)),
+ [pool, speciesId, boneIds],
+ )
+
+ function toggle(id: string) {
+ onChange(selected.includes(id) ? selected.filter((x) => x !== id) : [...selected, id])
+ }
+
+ if (filtered.length === 0) {
+ return (
+
+ Aucune pathologie de référence pour ces zones. Ajoutez-en une en texte libre ci-dessous.
+
+ )
+ }
+
+ return (
+
+ {filtered.map((p) => (
+ -
+
+
+ ))}
+
+ )
}
diff --git a/tests/unit/components.PathologyPicker.test.tsx b/tests/unit/components.PathologyPicker.test.tsx
new file mode 100644
index 00000000..acc73421
--- /dev/null
+++ b/tests/unit/components.PathologyPicker.test.tsx
@@ -0,0 +1,57 @@
+import { describe, it, expect, vi } from 'vitest'
+import { render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import PathologyPicker from '@/components/observation/PathologyPicker'
+import type { Pathology } from '@/domain/schema/pathology'
+
+const POOL: Pathology[] = [
+ {
+ id: 'a',
+ labelFr: 'Aïe',
+ description: '',
+ category: 'osseux',
+ speciesIds: ['equine'],
+ boneIds: ['epaule'],
+ sources: [{ type: 'manual', citation: 'X' }],
+ },
+ {
+ id: 'b',
+ labelFr: 'Aïe-aïe',
+ description: '',
+ category: 'osseux',
+ speciesIds: ['equine'],
+ boneIds: ['hanche'],
+ sources: [{ type: 'manual', citation: 'X' }],
+ },
+]
+
+describe('PathologyPicker', () => {
+ it('shows only pathologies matching zones', () => {
+ render(
+ {}}
+ />,
+ )
+ expect(screen.getByLabelText('Aïe')).toBeInTheDocument()
+ expect(screen.queryByLabelText('Aïe-aïe')).toBeNull()
+ })
+
+ it('toggles selection', async () => {
+ const onChange = vi.fn()
+ render(
+ ,
+ )
+ await userEvent.click(screen.getByLabelText('Aïe'))
+ expect(onChange).toHaveBeenCalledWith(['a'])
+ })
+})