@@ -15,6 +15,7 @@ import {
1515} from "./event-log.js" ;
1616import { formatElapsed } from "./in-flight-indicator.js" ;
1717import type { ContentBlock , ContentBlockData } from "../use-stream.js" ;
18+ import { color } from "../theme.js" ;
1819
1920function asBlock ( data : ContentBlockData & { id : string } ) : ContentBlock {
2021 return data as ContentBlock ;
@@ -706,6 +707,25 @@ describe("flat line buffer", () => {
706707 }
707708 } ) ;
708709
710+ test ( "user banner spacer rows have no background while body keeps userMessageBg" , ( ) => {
711+ const block : ContentBlock = { type : "user" , id : "user-bg" , content : "hello" } ;
712+ const lines = buildLines ( [ block ] , COLUMNS , false , isExpanded ) ;
713+ // blank spacer, body, blank spacer
714+ expect ( lines . length ) . toBe ( 3 ) ;
715+ const bg = color ( "userMessageBg" ) ;
716+ expect ( lines [ 0 ] ! . every ( ( seg ) => seg . backgroundColor === undefined ) ) . toBe ( true ) ;
717+ expect ( lines [ 2 ] ! . every ( ( seg ) => seg . backgroundColor === undefined ) ) . toBe ( true ) ;
718+ expect ( lines [ 1 ] ! . some ( ( seg ) => seg . backgroundColor === bg ) ) . toBe ( true ) ;
719+ expect ( lines [ 1 ] ! . every ( ( seg ) => seg . backgroundColor === bg ) ) . toBe ( true ) ;
720+ } ) ;
721+
722+ test ( "empty or whitespace user content yields no grey box" , ( ) => {
723+ for ( const content of [ "" , " " , "\n\t" ] ) {
724+ const block : ContentBlock = { type : "user" , id : "empty-user" , content } ;
725+ expect ( buildLines ( [ block ] , COLUMNS , false , isExpanded ) ) . toEqual ( [ ] ) ;
726+ }
727+ } ) ;
728+
709729 test ( "buildResourceBanner shows brand, workspace path, and optional skills/plugins" , ( ) => {
710730 const workspace = "/home/user/project" ;
711731 const banner = buildResourceBanner ( [ { name : "scribe" } , { name : "tdd" } ] , [ "exa" ] , 80 , workspace ) ;
0 commit comments