test(goal): close the per-file coverage gaps for the goal surface

- projection.spec covers applyGoalProjection's non-message early return and
  the foreign-change-kind arm directly (the pure-function posture the unit
  requires — a throwing apply would tear down the registry drive).
- New ui-goal browser-plugin spec exercises the plugin body over a real
  cordis Context with fake faces: dock registration (id/order), verbs
  reading the CAS ref from the current projected value, the
  no-current-goal short circuit, RPC-error mapping, HMR disposal, the
  GoalDock adapter's three projection states, and the inert node half.
This commit is contained in:
imccyu
2026-07-28 23:41:19 +08:00
parent da4e54b515
commit 1c43ff3061
6 changed files with 196 additions and 13 deletions

View File

@@ -77,8 +77,8 @@ export function GoalBar({ goal, onEdit, onResume, onClear }: GoalBarProps) {
type="text"
aria-label="Goal objective"
value={draft}
onChange={e => setDraft(e.target.value)}
onKeyDown={e => {
onChange={(e) => { setDraft(e.target.value) }}
onKeyDown={(e) => {
if (e.key === 'Enter') void handleEdit()
if (e.key === 'Escape') setEditing(false)
}}
@@ -99,7 +99,7 @@ export function GoalBar({ goal, onEdit, onResume, onClear }: GoalBarProps) {
<button
type="button"
className={css.iconBtn}
onClick={() => setEditing(false)}
onClick={() => { setEditing(false) }}
disabled={pending}
title="Cancel edit"
aria-label="Cancel edit"

View File

@@ -12,15 +12,15 @@ export type GoalActionResult =
| { ok: true }
| { ok: false; error: { code: string; message: string } }
/** Injected business face of the GoalBar dock entry: the mutation verbs. */
/** Injected business face of the GoalBar dock entry: the mutation verbs (function properties: the strip destructures them freely). */
export interface GoalBarActions {
/**
* Replace the current goal's objective (CAS on the projected ref).
* @param objective - replacement objective text.
*/
onEdit(objective: string): Promise<GoalActionResult>
onEdit: (objective: string) => Promise<GoalActionResult>
/** Resume a paused goal. */
onResume(): Promise<GoalActionResult>
onResume: () => Promise<GoalActionResult>
/** Clear the current goal (tombstone). */
onClear(): Promise<GoalActionResult>
onClear: () => Promise<GoalActionResult>
}