@@ -91,7 +91,10 @@ describe('localizeMetadataForm — the spec form, in the author’s language', (
9191 'dashboard' ,
9292 'zh-CN' ,
9393 ) ;
94- expect ( fieldByName ( zh , 'columns' ) ) . toMatchObject ( { label : '列数' , helpText : '栅格列数(默认 12)' } ) ;
94+ expect ( fieldByName ( zh , 'columns' ) ) . toMatchObject ( {
95+ label : '列数' ,
96+ helpText : '组件排布所用的列数,1 到 24。留空时仪表盘会按组件的宽度自动选择。' ,
97+ } ) ;
9598 expect ( fieldByName ( zh , 'refreshIntervalSeconds' ) ?. label ) . toBe ( '自动刷新' ) ;
9699 expect ( fieldByName ( zh , 'header' ) ?. label ) . toBe ( '页眉' ) ;
97100 } ) ;
@@ -105,31 +108,46 @@ describe('localizeMetadataForm — the spec form, in the author’s language', (
105108 const gap = fieldByName ( zh , 'gap' ) ;
106109 expect ( gap ?. label ) . toBe ( '间距' ) ;
107110
108- // ⚠️ THE CONTROL IS NOT A SENTENCE PIN, and it used to be one. This asserted
109- // that the English producer copy still said "Tailwind" — true while the spec
110- // shipped `Grid gap (Tailwind units)`, and false from @objectstack/spec
111- // 17.4.0, which rewrote it to "Space between widgets, in steps of 0.25rem
112- // (4 = 1rem)" (objectui#8785). The producer was right to fix its own copy;
113- // the pin was wrong to name a sentence it does not own, and re-pointing it
114- // at the new sentence would buy exactly one release before rotting again.
115- //
116- // What this test actually claims is narrower and durable: the overlay hands
117- // the author text they can act on, where the producer's copy reaches for
118- // DEVELOPER vocabulary — a framework name, a CSS unit — to say the same
119- // thing. So the control asserts the English carries some of that vocabulary
120- // and the zh carries none of it. It stays non-vacuous (the English leg must
121- // fire for the zh leg to mean anything) without pinning any one wording, and
122- // if the spec ever writes this hint in plain author language the control
123- // reddens and someone re-reads the overlay — which is the correct outcome,
124- // not a false alarm: the overlay would have nothing left to do here.
111+ // The control used to read the PRODUCER's English and assert it still
112+ // carried developer vocabulary, so that the zh leg meant something. That leg
113+ // was built to redden once the spec spoke plainly, and it did: the spec's
114+ // hints were rewritten in author language (objectstack#36816). The
115+ // vocabulary test now proves it can fire against a FIXED literal, the hint
116+ // as the spec shipped it before that rewrite, and then holds BOTH the
117+ // producer's English and the zh overlay free of it.
125118 // A framework name, or a CSS length written as an author never would —
126119 // digits welded to a unit. ⚠️ `\brem\b` does NOT work here: the boundary
127120 // before `rem` never matches in `0.25rem`, because `5` is a word character.
128121 const DEVELOPER_UNITS = / t a i l w i n d | \d \s * ( r e m | p x ) \b / i;
129- expect ( fieldByName ( dashboardForm , 'gap' ) ?. helpText ) . toMatch ( DEVELOPER_UNITS ) ;
122+ expect ( 'Space between widgets, in steps of 0.25rem (4 = 1rem)' ) . toMatch ( DEVELOPER_UNITS ) ;
123+ expect ( fieldByName ( dashboardForm , 'gap' ) ?. helpText ) . not . toMatch ( DEVELOPER_UNITS ) ;
130124 expect ( gap ?. helpText ) . not . toMatch ( DEVELOPER_UNITS ) ;
131125 } ) ;
132126
127+ it ( 'no dashboard hint, English or zh, uses developer vocabulary' , ( ) => {
128+ const zh = localizeMetadataForm (
129+ dashboardForm as unknown as Record < string , unknown > ,
130+ 'dashboard' ,
131+ 'zh-CN' ,
132+ ) ;
133+ // Casing jargon and "config" join the units: the hints the spec shipped
134+ // before objectstack#36816 said "snake_case unique identifier" and
135+ // "Dashboard header config (title, subtitle, actions)".
136+ const DEVELOPER_VOCABULARY = / t a i l w i n d | \d \s * ( r e m | p x ) \b | s n a k e _ c a s e | \b c o n f i g \b / i;
137+ expect ( 'snake_case unique identifier' ) . toMatch ( DEVELOPER_VOCABULARY ) ;
138+ const hints = ( form : Record < string , unknown > | undefined ) =>
139+ sections ( form ) . flatMap ( ( s ) => ( s . fields ?? [ ] ) . flatMap ( ( f ) => [ f , ...( f . fields ?? [ ] ) ] ) )
140+ . filter ( ( f ) => typeof f . helpText === 'string' )
141+ . map ( ( f ) => `${ f . field } : ${ f . helpText } ` ) ;
142+ const en = hints ( dashboardForm as unknown as Record < string , unknown > ) ;
143+ const zhHints = hints ( zh ) ;
144+ // Non-vacuity: both forms carry the nine top-level hints and more.
145+ expect ( en . length ) . toBeGreaterThanOrEqual ( 9 ) ;
146+ expect ( zhHints . length ) . toBeGreaterThanOrEqual ( 9 ) ;
147+ expect ( en . filter ( ( h ) => DEVELOPER_VOCABULARY . test ( h ) ) ) . toEqual ( [ ] ) ;
148+ expect ( zhHints . filter ( ( h ) => DEVELOPER_VOCABULARY . test ( h ) ) ) . toEqual ( [ ] ) ;
149+ } ) ;
150+
133151 it ( 'synthesizes ALL of the `header` composite’s sub-rows — a partial list would hide the rest' , ( ) => {
134152 const zh = localizeMetadataForm (
135153 dashboardForm as unknown as Record < string , unknown > ,
0 commit comments