@@ -291,6 +291,62 @@ suite.define(() => {
291291 expect ( await companionMenu . count ( ) ) . toBe ( 1 ) ;
292292 expect ( await contentActions . locator ( ":scope > button" ) . count ( ) ) . toBe ( 0 ) ;
293293
294+ const tab = page . locator ( ".side-panel__header .tabstrip-tab[active]" ) ;
295+ for ( const direction of [ "ltr" , "rtl" ] as const ) {
296+ const tabPadding = await tab . evaluate ( ( node , dir ) => {
297+ const panel = node . closest ( ".side-panel" ) ;
298+ if ( ! ( panel instanceof HTMLElement ) ) {
299+ throw new Error ( "Active side-panel tab must render inside the side panel" ) ;
300+ }
301+ panel . dir = dir ;
302+ const tabBase = node . shadowRoot ?. querySelector < HTMLElement > ( "[part~='base']" ) ;
303+ const leadingGlyph = node . querySelector < HTMLElement > ( ".tabstrip-tab__icon svg" ) ;
304+ const close = node . nextElementSibling ;
305+ const trailingGlyph = close ?. querySelector < HTMLElement > ( "svg" ) ;
306+ if ( ! ( close instanceof HTMLElement ) || ! tabBase || ! leadingGlyph || ! trailingGlyph ) {
307+ throw new Error ( "Active side-panel tab must render both edge glyphs" ) ;
308+ }
309+ const tabBounds = tabBase . getBoundingClientRect ( ) ;
310+ const closeBounds = close . getBoundingClientRect ( ) ;
311+ const leadingBounds = leadingGlyph . getBoundingClientRect ( ) ;
312+ const trailingBounds = trailingGlyph . getBoundingClientRect ( ) ;
313+ const rtl = dir === "rtl" ;
314+ const tabStyle = getComputedStyle ( tabBase ) ;
315+ const closeStyle = getComputedStyle ( close ) ;
316+ return {
317+ leading : rtl
318+ ? tabBounds . right - leadingBounds . right
319+ : leadingBounds . left - tabBounds . left ,
320+ trailing : rtl
321+ ? trailingBounds . left - closeBounds . left
322+ : closeBounds . right - trailingBounds . right ,
323+ tabOuterRadius : Number . parseFloat (
324+ rtl ? tabStyle . borderTopRightRadius : tabStyle . borderTopLeftRadius ,
325+ ) ,
326+ tabJoinRadius : Number . parseFloat (
327+ rtl ? tabStyle . borderTopLeftRadius : tabStyle . borderTopRightRadius ,
328+ ) ,
329+ closeJoinRadius : Number . parseFloat (
330+ rtl ? closeStyle . borderTopRightRadius : closeStyle . borderTopLeftRadius ,
331+ ) ,
332+ closeOuterRadius : Number . parseFloat (
333+ rtl ? closeStyle . borderTopLeftRadius : closeStyle . borderTopRightRadius ,
334+ ) ,
335+ } ;
336+ } , direction ) ;
337+ expect ( tabPadding . trailing , `${ direction } glyph insets` ) . toBeCloseTo ( tabPadding . leading , 0 ) ;
338+ expect ( tabPadding . tabJoinRadius , `${ direction } tab join` ) . toBe ( 0 ) ;
339+ expect ( tabPadding . closeJoinRadius , `${ direction } close join` ) . toBe ( 0 ) ;
340+ expect ( tabPadding . tabOuterRadius , `${ direction } tab outer` ) . toBeGreaterThan ( 0 ) ;
341+ expect ( tabPadding . closeOuterRadius , `${ direction } close outer` ) . toBeGreaterThan ( 0 ) ;
342+ }
343+ await tab . evaluate ( ( node ) => {
344+ const panel = node . closest ( ".side-panel" ) ;
345+ if ( panel instanceof HTMLElement ) {
346+ panel . removeAttribute ( "dir" ) ;
347+ }
348+ } ) ;
349+
294350 await page . locator ( ".side-panel-type-menu__trigger" ) . click ( ) ;
295351 await page . locator ( ".side-panel-type-menu__item" ) . filter ( { hasText : "Discussion" } ) . click ( ) ;
296352 const discussionAction = contentActions . locator (
0 commit comments