feat(anatomy): parse data-anno-lateral attribute from SVG
Read data-anno-lateral from annotated SVG elements and expose it as
Bone.lateral ('bilateral' | 'unpaired' | undefined). Follows the same
merge logic used for data-anno-special.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
2d5ff54b69
commit
db50c67bb6
3 files changed
+22
No files matched your search
@@ -22,6 +22,8 @@ const FIXTURE = `
|
||||
<polygon data-anno-id="zone-head" data-anno-category="os" data-anno-opens-detail="head" />
|
||||
<polygon data-anno-id="zone-future" data-anno-name-fr="Catégorie inédite"
|
||||
data-anno-category="something-new-the-parser-has-never-seen" />
|
||||
<circle data-anno-id="point-knee" data-anno-name-fr="Genou" data-anno-name-en="Knee"
|
||||
data-anno-category="articulations" data-anno-lateral="bilateral" />
|
||||
</svg>`
|
||||
|
||||
describe('parseSvgBones', () => {
|
||||
@@ -59,6 +61,16 @@ describe('parseSvgBones', () => {
|
||||
'something-new-the-parser-has-never-seen',
|
||||
)
|
||||
})
|
||||
|
||||
it('captures data-anno-lateral when present', () => {
|
||||
const map = parseSvgBones(svgFromString(FIXTURE))
|
||||
expect(map.get('point-knee')?.lateral).toBe('bilateral')
|
||||
})
|
||||
|
||||
it('leaves lateral undefined when attribute absent', () => {
|
||||
const map = parseSvgBones(svgFromString(FIXTURE))
|
||||
expect(map.get('point-shoulder')?.lateral).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
describe('parseSvgBones validation', () => {
|
||||
|
||||
Reference in new issue
Block a user