openpencil/tests/engine/color/solid-commit.test.ts
Danila Poyarkov 9e4d7bee5d chore(lint): fix unused test code
- Remove stale imports and unused locals from split engine and e2e tests
- Drop the targeted no-unused-vars test allowances
- Keep check and affected test suites warning-free
2026-05-06 02:53:19 +03:00

26 lines
820 B
TypeScript

import { describe, expect, test } from 'bun:test'
import type { Fill } from '@open-pencil/core'
import { applySolidFillColor, applySolidStrokeColor } from '@open-pencil/vue'
describe('solid color commit helpers', () => {
test('syncs fill opacity with color alpha', () => {
const fill: Fill = {
type: 'SOLID',
visible: true,
opacity: 1,
color: { r: 1, g: 0, b: 0, a: 1 }
}
const updated = applySolidFillColor(fill, { r: 0, g: 1, b: 0, a: 0.4 })
expect(updated.color.a).toBeCloseTo(0.4, 5)
expect(updated.opacity).toBeCloseTo(0.4, 5)
})
test('syncs stroke opacity with color alpha', () => {
const updated = applySolidStrokeColor({ r: 1, g: 1, b: 0, a: 0.2 })
expect(updated.color?.a).toBeCloseTo(0.2, 5)
expect(updated.opacity).toBeCloseTo(0.2, 5)
})
})