From 0883c0fc37840bd0eee527d694880d817c9f6375 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Sep 2026 06:20:28 +0000 Subject: [PATCH] test(components): drop the undeclared `value` key from the two menu icon transcriptions `context-menu-item-icon.test.tsx` and `dropdown-menu-item-icon.test.tsx` each carry an inline transcription of a catalog overlay-menu fixture. Both copies still spelled `value`, a key no arm of the `MenuItem` union declares (objectui#6523 narrowed that union deliberately) and no menu renderer reads. objectui#7072 removed the key from the four fixtures; these copies were outside that card's fenced surface, so the phantom spelling survived next to the renderer as copyable example code. Deleted the 4 + 3 `value` entries. The context-menu block is now key-for-key identical to `basic-context-menu.json`'s `items`. Each block also records why the key is absent, because the deletion alone is invisible to the next author: a parse-based pin could not guard it. `MenuItemSchema`'s arms are non-strict `z.object`s, so `{ label, value, icon }` parses with `success=true` and `value` silently stripped -- indistinguishable from the clean shape. Measured, with live negative controls: `type: 'separator'` and a wrongly typed `label` are both refused by the same parse, so the instrument can say no. Both suites pass identically before and after: 2 files, 15 tests. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_012wwHa4aaFybxXrfmfHioDM --- .changeset/menu-icon-test-phantom-value.md | 7 +++++++ .../__tests__/context-menu-item-icon.test.tsx | 18 ++++++++++++++---- .../__tests__/dropdown-menu-item-icon.test.tsx | 14 +++++++++++--- 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 .changeset/menu-icon-test-phantom-value.md diff --git a/.changeset/menu-icon-test-phantom-value.md b/.changeset/menu-icon-test-phantom-value.md new file mode 100644 index 0000000000..ca89894e20 --- /dev/null +++ b/.changeset/menu-icon-test-phantom-value.md @@ -0,0 +1,7 @@ +--- +--- + +Test-only change: the two overlay-menu icon suites (`context-menu-item-icon`, +`dropdown-menu-item-icon`) no longer transcribe the undeclared `value` key from +the catalog fixtures objectui#7072 cleaned, and each block now records why the +key is absent. No published source and no rendered behaviour changes. diff --git a/packages/components/src/__tests__/context-menu-item-icon.test.tsx b/packages/components/src/__tests__/context-menu-item-icon.test.tsx index 3571026447..e3c8a6a394 100644 --- a/packages/components/src/__tests__/context-menu-item-icon.test.tsx +++ b/packages/components/src/__tests__/context-menu-item-icon.test.tsx @@ -164,13 +164,23 @@ describe('ui:context-menu item icon resolution (objectui#6278)', () => { // specimen AND a declared AI few-shot retrieval source, so every name it // ships must draw. Spelling drift is the gate's job (see the header); // this row is the renderer's half of that contract. + // + // ⛔ No `value` key here, and its absence is deliberate. These items are a + // TRANSCRIPTION of the fixture, so a key the fixture does not carry is a + // spelling the next author copies out of here. No arm of the `MenuItem` + // union declares `value` — objectui#6523 narrowed that union on purpose — + // and no menu renderer reads it; objectui#7072 deleted it from the four + // catalog fixtures and objectui#7102 from these copies. Re-adding it would + // NOT go red: `MenuItemSchema`'s arms are non-strict `z.object`s, so zod + // strips the key and reports success. Hence this note rather than a pin — + // a parse-based pin here could not fail. it('draws a distinct glyph for each of the four authored names', () => { renderMenu([ - { label: 'Copy', value: 'copy', icon: 'copy' }, - { label: 'Cut', value: 'cut', icon: 'scissors' }, - { label: 'Paste', value: 'paste', icon: 'clipboard' }, + { label: 'Copy', icon: 'copy' }, + { label: 'Cut', icon: 'scissors' }, + { label: 'Paste', icon: 'clipboard' }, { separator: true }, - { label: 'Delete', value: 'delete', icon: 'trash' }, + { label: 'Delete', icon: 'trash' }, ]); for (const [label, name] of [ ['Copy', 'copy'], diff --git a/packages/components/src/__tests__/dropdown-menu-item-icon.test.tsx b/packages/components/src/__tests__/dropdown-menu-item-icon.test.tsx index 959d480d24..b36bb05990 100644 --- a/packages/components/src/__tests__/dropdown-menu-item-icon.test.tsx +++ b/packages/components/src/__tests__/dropdown-menu-item-icon.test.tsx @@ -117,11 +117,19 @@ describe('ui:dropdown-menu item icon resolution (objectui#5930)', () => { // The fixture is a live specimen AND a declared AI few-shot retrieval // source, so every name it ships must actually draw. `square-pen` is the // identity-derived live key for the retired `edit` this fixture carried. + // + // ⛔ No `value` key here, and its absence is deliberate — same reason as + // the twin block in `context-menu-item-icon.test.tsx`, which carries the + // long form. In short: no arm of the `MenuItem` union declares `value` + // (objectui#6523), no menu renderer reads it, objectui#7072 removed it + // from the fixtures and objectui#7102 from these copies — and re-adding + // it could not go red, because `MenuItemSchema` is non-strict and strips + // the key while reporting success. it('draws a glyph for every icon name it declares', () => { renderMenu([ - { label: 'Edit', value: 'edit', icon: 'square-pen' }, - { label: 'Copy', value: 'copy', icon: 'copy' }, - { label: 'Delete', value: 'delete', icon: 'trash' }, + { label: 'Edit', icon: 'square-pen' }, + { label: 'Copy', icon: 'copy' }, + { label: 'Delete', icon: 'trash' }, ]); for (const label of ['Edit', 'Copy', 'Delete']) { expect(glyphFor(label), `${label} should draw a glyph`).not.toBeNull();