@@ -578,6 +578,58 @@ test('TRANSCRIPT: the user bubble hugs its content, and is capped short of the c
578578 'tint is the secondary cue and still earns its place — side alone would drop on a wrapped log' ) ;
579579} ) ;
580580
581+ test ( 'CODE: prose blocks get room, and nothing else that uses <pre> moves' , ( ) => {
582+ // docs/CHAT-TYPOGRAPHY.md D5/T3. `pre` is a GLOBAL selector in this file, and it draws four different
583+ // things: the empty state's ASCII logo, the MCP approval card's command block, the terminal output
584+ // pane, and the prose code block D5 is actually about. Only the logo has no padding override of its
585+ // own — so widening bare `pre` would quietly move it, which is the T2 mistake (`.msg` vs `.msg .body`)
586+ // waiting in a new place.
587+ const gates = [ ...cssBlocks . matchAll ( / @ m e d i a \( m i n - w i d t h : 7 6 0 p x \) / g) ] . map ( ( m ) => m . index ) ;
588+ const at = gates . find ( ( i ) => blockAt ( cssBlocks , i ) . includes ( '#log {' ) ) ;
589+ assert . ok ( at !== undefined , 'the rhythm gate is gone' ) ;
590+ const block = blockAt ( cssBlocks , at ) ;
591+
592+ assert . match ( block , / \. m s g \. b o d y p r e \{ [ ^ } ] * p a d d i n g : / ,
593+ 'the code-block padding must be scoped to .msg .body pre' ) ;
594+ assert . ok ( ! / ^ \s * p r e \{ [ ^ } ] * p a d d i n g : \s * 1 2 p x / m. test ( css ) ,
595+ 'bare `pre` was widened — that moves the ASCII logo and the approval cards too' ) ;
596+ assert . match ( css , / ^ \s * p r e \{ [ ^ } ] * p a d d i n g : \s * 9 p x 1 1 p x / m,
597+ 'the base `pre` padding changed; the logo and cards inherit it and have no override' ) ;
598+
599+ // Gated to reading width for the same reason D3 is: a 380px sidebar is deliberately dense, and
600+ // 6 more pixels a side is content width it does not have. Measured: at 420px the computed padding
601+ // and margins are identical to develop; at 1200px they are 12px 14px and 14px.
602+ // Membership in `block` above is what proves it is gated; this catches the narrower case of a SECOND
603+ // ungated copy declared earlier in the file, which would apply at every width and win nothing visible
604+ // in review.
605+ assert . ok ( ! / \. m s g \. b o d y p r e \{ [ ^ } ] * p a d d i n g : \s * 1 2 p x / . test ( css . slice ( 0 , at ) ) ,
606+ 'a second, ungated copy of the code-block padding is declared before the width gate' ) ;
607+
608+ // The margin joins D3's rhythm rather than staying an absolute, so raising the prose size opens the
609+ // spacing around a block with it.
610+ assert . match ( block , / \. m s g \. b o d y p r e \{ [ ^ } ] * m a r g i n : \s * [ \d . ] + e m / ,
611+ 'the block margin must be em-based, or it stops matching the paragraph spacing beside it' ) ;
612+ } ) ;
613+
614+ test ( 'CODE: inline code stays theme-driven — we still never set its colour' , ( ) => {
615+ // D5, and §1 before it: no `color` has ever been set here. The red/orange in dark themes comes from
616+ // the theme, so hard-coding one would fight every theme rather than fixing anything. It is the kind
617+ // of line that gets added while "tidying up the code style" and is invisible until someone switches
618+ // to a light theme.
619+ const rule = / : n o t \( p r e \) > c o d e \{ ( [ ^ } ] * ) \} / . exec ( css ) ;
620+ assert . ok ( rule , 'the inline-code rule is gone' ) ;
621+ assert . ok ( ! / ( ^ | ; ) \s * c o l o r \s * : / . test ( rule [ 1 ] ) ,
622+ 'inline code now sets a colour — D5 keeps this theme-driven: ' + rule [ 1 ] . trim ( ) ) ;
623+ assert . match ( rule [ 1 ] , / b a c k g r o u n d : \s * v a r \( - - v s c o d e - t e x t C o d e B l o c k - b a c k g r o u n d / ,
624+ 'inline code must keep the theme background it has always had' ) ;
625+
626+ // Its padding stays tight ON PURPOSE. Vertical padding on an inline box does not grow the line box,
627+ // so a roomier inline code span overlaps the line above it — "code surfaces get room" applies to
628+ // blocks, not to spans.
629+ assert . match ( rule [ 1 ] , / p a d d i n g : \s * 1 p x 5 p x / ,
630+ 'inline padding grew; on an inline box that overlaps the neighbouring line rather than adding room' ) ;
631+ } ) ;
632+
581633test ( 'TRANSCRIPT: the heading scale has steps you can actually see' , ( ) => {
582634 // The old 1.3/1.18/1.07 put 0.11em between h2 and h3 — 1.4px at 13px, i.e. three levels of
583635 // hierarchy that were indistinguishable without selecting the text.
0 commit comments