Skip to content

Commit 3469199

Browse files
committed
test(sdui-parser): the root base-props twin pins the three retired dialects
base-props-one-list.test.ts listed visibleOn / hiddenOn / disabledOn among the every-node members. With #26274 carried onto this parser they are no longer base props: each draws one unknown-prop naming its canonical key, and the list is 17 entries. Claude-Session: https://claude.ai/code/session_01Xe3LjBvLrRVA6dmFUEGskm Co-authored-by: Claude <noreply@anthropic.com>
1 parent 22ae443 commit 3469199

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

‎packages/sdui-parser/src/__tests__/base-props-one-list.test.ts‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ const codes = (node: SchemaElement): string[] =>
2727
validateTree(node, manifest).diagnostics.map((d) => d.code);
2828

2929
const EVERY_NODE = [
30-
'id', 'className', 'style', 'visible', 'visibleWhen', 'visibleOn', 'hidden',
31-
'hiddenOn', 'disabled', 'disabledOn', 'bind', 'testId', 'children',
30+
'id', 'className', 'style', 'visible', 'visibleWhen', 'hidden',
31+
'disabled', 'bind', 'testId', 'children',
3232
];
33+
// The retired node-level dialects (#25926) left the list: each draws ONE
34+
// `unknown-prop` that names its canonical key (`retired-visibility-dialects.ts`).
35+
const RETIRED_DIALECTS = [
36+
['visibleOn', 'visibleWhen'],
37+
['hiddenOn', 'hidden'],
38+
['disabledOn', 'disabled'],
39+
] as const;
3340
// `type` is the one `every-node` entry with no attribute form: on a node it
3441
// IS the tag, so a node cannot carry it without being the component under test.
3542
// It is pinned through the list below, not through `validateTree`.
@@ -41,6 +48,12 @@ describe('base props — one list, two scopes (objectui#11008, #11044)', () => {
4148
expect(codes(node)).not.toContain('unknown-prop');
4249
});
4350

51+
it.each(RETIRED_DIALECTS)('the retired `%s` draws one unknown-prop naming `%s`', (key, canonical) => {
52+
const diags = validateTree({ type: 'leaf', [key]: 'x' } as SchemaElement, manifest).diagnostics;
53+
expect(diags.map((d) => d.code)).toEqual(['unknown-prop']);
54+
expect(diags[0]!.message).toContain(`"${canonical}"`);
55+
});
56+
4457
it.each(WHERE_UNDECLARED)('undeclared `%s` draws no unknown-prop', (key) => {
4558
expect(codes({ type: 'leaf', [key]: 'x' } as SchemaElement)).toEqual([]);
4659
});
@@ -51,7 +64,7 @@ describe('base props — one list, two scopes (objectui#11008, #11044)', () => {
5164
expect(validateTree({ type: 'labelled', label: 'ok' } as SchemaElement, manifest).diagnostics).toEqual([]);
5265
});
5366

54-
it('the list is the 20 entries, `type` alone having no attribute type', () => {
67+
it('the list is the 17 entries, `type` alone having no attribute type', () => {
5568
expect(SDUI_BASE_PROPS.map((p) => p.name)).toEqual(['type', ...EVERY_NODE, ...WHERE_UNDECLARED]);
5669
expect(SDUI_BASE_PROPS.filter((p) => p.tsType === null).map((p) => p.name)).toEqual(['type']);
5770
expect(SDUI_BASE_PROPS.filter((p) => p.scope === 'every-node').map((p) => p.name)).toEqual(['type', ...EVERY_NODE]);

0 commit comments

Comments
 (0)