Files
deepseek-harness/packages/client/ui-primitives/tests/state-dot-styles.client.spec.ts
T
Yichen Jiang 452b2a816a refactor(client): share the capsule tag, switch, and idle state dot
Client feature plugins never import one another's components, so
ui-primitives is their only channel for sharing one. Nothing told an
author to look there first, and the package offered nothing to look
at: its README named six source files against forty-plus exports.

Add Tag (read-only capsule badge, eight tones) and Switch (36x20
toggle with a required accessible name), extend StateDotState with
idle for a tracked subject with no activity, and move ui-agent-preset,
ui-settings-plugins, and ui-settings-plugin-inventory onto them.

The plugin inventory's conditional tag referenced
--dsw-alias-state-warning-primary, which does not exist, so both
themes had been painting its hardcoded #b45309 fallback.

State the reuse rule as the first step of the new-component checklist,
and give the README a component catalog so the rule has something to
check. The rule is guidance, not a gate: a package may still write its
own control, and the Agent Note records the five that stay local.
2026-09-05 14:32:59 +08:00

24 lines
996 B
TypeScript

/**
* StateDot's palette as CSS text. jsdom has no layout and CSS Modules resolve
* to class-name maps in the component suites, so the only place the per-state
* colors can be read is the stylesheet itself: a state whose rule is missing
* renders on the inherited color instead of its own, which no render assertion
* would catch.
*/
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
const css = readFileSync(fileURLToPath(new URL('../src/StateDot.module.css', import.meta.url)), 'utf8')
describe('StateDot.module.css', () => {
it.each(['done', 'warning', 'error', 'idle'] as const)('gives the %s state its own color rule', (state) => {
expect(css).toContain(`.dot[data-state='${state}']`)
})
it('keeps ongoing on the animated matrix rather than a solid-dot rule', () => {
expect(css).not.toContain(".dot[data-state='ongoing']")
expect(css).toContain('@keyframes dsh-state-dot-chase')
})
})