Files
waveform-analysis/src/components/waveformLegendGeometry.test.ts
liqiyuan 082462cf67
Some checks failed
Package component / package (push) Failing after 4m19s
refactor(chart): enforce 400-line source limit
2026-07-27 15:05:13 +08:00

22 lines
1008 B
TypeScript

import { describe, expect, it } from 'vitest'
import {
waveformLegendErrorBarPath,
waveformLegendLinePath,
waveformLineDasharray,
} from './rendering/seriesStyle'
describe('legend series geometry', () => {
it('keeps line samples centered and clamps error-bar caps to the swatch', () => {
expect(waveformLegendLinePath('linear')).toBe('M1 8H25')
expect(waveformLegendLinePath('step-start')).toBe('M1 8H25')
expect(waveformLegendLinePath('step-middle')).toBe('M1 8H25')
expect(waveformLegendLinePath('step-end')).toBe('M1 8H25')
expect(waveformLegendLinePath('step-after')).toBe('M1 8H25')
expect(waveformLegendLinePath('none')).toBeNull()
expect(waveformLegendErrorBarPath(10)).toBe('M8 2H18M13 2V14M8 14H18')
expect(waveformLegendErrorBarPath(100)).toBe('M1 2H25M13 2V14M1 14H25')
expect(waveformLineDasharray('solid')).toBeUndefined()
expect(waveformLineDasharray('dashed')).toBe('8 5')
expect(waveformLineDasharray('dash-dot')).toBe('8 5 1.5 5')
})
})