@@ -2055,6 +2055,47 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
20552055 } ,
20562056 ) ;
20572057
2058+ it . each ( [ "dark" , "light" ] as const ) (
2059+ "fits short table cards to their columns in %s mode" ,
2060+ async ( themeMode ) => {
2061+ const page = await openBrowserPage ( 800 , 400 ) ;
2062+ try {
2063+ await page . setContent (
2064+ `<!doctype html><html data-theme-mode="${ themeMode } "><head><style>${ readUiCss ( ) } </style></head><body>
2065+ <div class="chat-text">
2066+ <div data-table-lane style="width: 680px">
2067+ <table data-short-table><thead><tr><th>Name</th><th>Status</th></tr></thead><tbody><tr><td>Gateway</td><td>Ready</td></tr></tbody></table>
2068+ </div>
2069+ <div data-narrow-table-lane style="width: 160px">
2070+ <table data-narrow-table><thead><tr><th>Name</th><th>Status</th></tr></thead><tbody><tr><td>Gateway</td><td>Ready</td></tr></tbody></table>
2071+ </div>
2072+ </div>
2073+ </body></html>` ,
2074+ ) ;
2075+
2076+ const geometry = await page . evaluate ( ( ) => {
2077+ const rectFor = ( selector : string ) =>
2078+ document . querySelector < HTMLElement > ( selector ) ! . getBoundingClientRect ( ) ;
2079+ const shortTable = rectFor ( "[data-short-table]" ) ;
2080+ const lastCell = rectFor ( "[data-short-table] tbody td:last-child" ) ;
2081+ return {
2082+ laneWidth : rectFor ( "[data-table-lane]" ) . width ,
2083+ narrowLaneWidth : rectFor ( "[data-narrow-table-lane]" ) . width ,
2084+ narrowTableWidth : rectFor ( "[data-narrow-table]" ) . width ,
2085+ shortTableWidth : shortTable . width ,
2086+ trailingGap : shortTable . right - lastCell . right ,
2087+ } ;
2088+ } ) ;
2089+
2090+ expect ( geometry . shortTableWidth ) . toBeLessThan ( geometry . laneWidth ) ;
2091+ expect ( geometry . trailingGap ) . toBeLessThanOrEqual ( 1 ) ;
2092+ expect ( geometry . narrowTableWidth ) . toBeCloseTo ( geometry . narrowLaneWidth , 0 ) ;
2093+ } finally {
2094+ await closeBrowserPage ( page ) ;
2095+ }
2096+ } ,
2097+ ) ;
2098+
20582099 it . each ( [ "dark" , "light" ] as const ) (
20592100 "keeps mobile controls inside the viewport with touch targets in %s mode" ,
20602101 async ( themeMode ) => {
0 commit comments