@@ -474,6 +474,7 @@ test("file tree expands Windows paths and scrolls long names in both directions"
474474 fileList : ( path ) => {
475475 if ( path === "frontend\\" || path === "frontend" ) {
476476 return [
477+ fileNode ( directory , "frontend/nested" , "directory" ) ,
477478 { ...fileNode ( directory , "frontend/app.ts" ) , path : "frontend\\app.ts" } ,
478479 { ...fileNode ( directory , longPath ) , path : `frontend\\${ longFilename } ` } ,
479480 // Short rows below the long one, so it can scroll out of view.
@@ -485,6 +486,8 @@ test("file tree expands Windows paths and scrolls long names in both directions"
485486 ]
486487 }
487488
489+ if ( path === "frontend/nested" ) return [ fileNode ( directory , "frontend/nested/child.ts" ) ]
490+
488491 if ( path ) return [ ]
489492
490493 return [
@@ -510,6 +513,36 @@ test("file tree expands Windows paths and scrolls long names in both directions"
510513 await frontend . click ( )
511514 await expect ( frontend ) . toHaveAttribute ( "aria-expanded" , "true" )
512515
516+ const nested = panel . locator ( '[data-type="item"][data-item-path="frontend/nested/"]' )
517+ await nested . click ( )
518+ const child = panel . locator ( '[data-type="item"][data-item-path="frontend/nested/child.ts"]' )
519+ await expect ( child ) . toBeVisible ( )
520+ await expect ( child . locator ( '[data-item-section="spacing-item"]' ) ) . toHaveCount ( 2 )
521+
522+ // Every ancestor guide runs through its folder's chevron, not just the first indentation level.
523+ const guideOffset = ( ) =>
524+ child . evaluate ( ( element ) => {
525+ const root = element . getRootNode ( )
526+
527+ if ( ! ( root instanceof ShadowRoot ) ) throw new Error ( "Expected the file tree's shadow root" )
528+
529+ return Math . max (
530+ ...Array . from ( element . querySelectorAll < HTMLElement > ( '[data-item-section="spacing-item"]' ) , ( guide ) => {
531+ const folder = Array . from ( root . querySelectorAll < HTMLElement > ( '[data-type="item"]' ) ) . find (
532+ ( row ) => row . dataset . itemPath === guide . dataset . ancestorPath ,
533+ ) !
534+
535+ const icon = folder . querySelector ( '[data-item-section="icon"]' ) ! . getBoundingClientRect ( )
536+ const line = guide . getBoundingClientRect ( )
537+ const center = getComputedStyle ( guide ) . direction === "rtl" ? line . right - 0.5 : line . left + 0.5
538+
539+ return Math . abs ( center - ( icon . left + icon . width / 2 ) )
540+ } ) ,
541+ )
542+ } )
543+
544+ await expect . poll ( guideOffset ) . toBeLessThanOrEqual ( 0.5 )
545+
513546 const viewport = sidebar . locator ( '[data-slot="session-review-v2-sidebar-viewport"]' )
514547 const longRow = panel . locator ( `[data-type="item"][data-item-path="${ longPath } "]` )
515548 const content = longRow . locator ( '[data-item-section="content"]' )
@@ -553,6 +586,7 @@ test("file tree expands Windows paths and scrolls long names in both directions"
553586 await expect . poll ( async ( ) => ( await scrollTree ( { } ) ) . left ) . toBeGreaterThan ( 0 )
554587 await scrollTree ( { left : 0 , top : 0 } )
555588 await viewport . evaluate ( ( element ) => element . setAttribute ( "dir" , "rtl" ) )
589+ await expect . poll ( guideOffset ) . toBeLessThanOrEqual ( 0.5 )
556590 await expect . poll ( ( ) => statusInset ( status , "left" ) ) . toBeLessThanOrEqual ( 24 )
557591 await frontend . focus ( )
558592 await page . keyboard . press ( "ArrowRight" )
0 commit comments