@@ -5,8 +5,6 @@ import { createRoot, type Root } from "react-dom/client";
55import { afterEach , beforeEach , expect , it , vi } from "vite-plus/test" ;
66import { page , userEvent } from "vite-plus/test/browser" ;
77
8- import { Button , InlineButton } from "../ui/button" ;
9-
108import { ComposerBannerStack } from "./ComposerBannerStack" ;
119
1210let root : Root ;
@@ -62,94 +60,6 @@ it("only offers notice details when the description cannot fit", async () => {
6260 expect ( hasDetails ( ) ) . toBe ( true ) ;
6361} ) ;
6462
65- it . each ( [ 320 , 800 ] ) (
66- "keeps long background-work links reachable beside Stop in a %ipx composer" ,
67- async ( width ) => {
68- await page . viewport ( width + 32 , 800 ) ;
69- container . style . width = `${ width } px` ;
70- const openThread = vi . fn ( ) ;
71- const label = "Review the background task layout and child-thread navigation " . repeat ( 6 ) ;
72- await act ( async ( ) =>
73- root . render (
74- < ComposerBannerStack
75- items = { [
76- {
77- id : "background-work" ,
78- variant : "default" ,
79- priority : "activity" ,
80- icon : null ,
81- title : "12 background tasks" ,
82- descriptionPlacement : "below" ,
83- description : Array . from ( { length : 12 } , ( _ , index ) => (
84- < span key = { index } >
85- { index > 0 ? " " : null }
86- < InlineButton
87- tone = "muted"
88- aria-label = { `Open subagent ${ index + 1 } ` }
89- onClick = { ( ) => openThread ( index + 1 ) }
90- >
91- { label }
92- </ InlineButton >
93- { index < 11 ? "," : null }
94- </ span >
95- ) ) ,
96- actions : (
97- < Button size = "xs" variant = "ghost" >
98- Stop
99- </ Button >
100- ) ,
101- } ,
102- ] }
103- /> ,
104- ) ,
105- ) ;
106- await nextFrame ( ) ;
107-
108- const firstLink = page . getByRole ( "button" , { name : "Open subagent 1" , exact : true } ) ;
109- const lastLink = page . getByRole ( "button" , { name : "Open subagent 12" , exact : true } ) ;
110- const stop = page . getByRole ( "button" , { name : "Stop" , exact : true } ) ;
111- expect ( firstLink . element ( ) . getBoundingClientRect ( ) . height ) . toBeGreaterThan (
112- Number . parseFloat ( getComputedStyle ( firstLink . element ( ) ) . lineHeight ) * 2 ,
113- ) ;
114- const viewport = container . querySelector < HTMLElement > ( '[data-slot="scroll-area-viewport"]' ) ! ;
115- expect ( viewport ) . not . toBeNull ( ) ;
116- expect ( viewport . clientHeight ) . toBeGreaterThan ( 0 ) ;
117- expect ( viewport . clientHeight ) . toBeLessThanOrEqual ( window . innerHeight / 2 ) ;
118- expect ( viewport . scrollHeight ) . toBeGreaterThan ( viewport . clientHeight ) ;
119- expect ( viewport . scrollWidth ) . toBeLessThanOrEqual ( viewport . clientWidth + 1 ) ;
120-
121- const scrollBounds = viewport . getBoundingClientRect ( ) ;
122- const stopBounds = stop . element ( ) . getBoundingClientRect ( ) ;
123- expect ( stopBounds . top ) . toBe (
124- page . getByText ( "12 background tasks" , { exact : true } ) . element ( ) . getBoundingClientRect ( ) . top ,
125- ) ;
126- expect ( scrollBounds . right ) . toBeLessThanOrEqual ( stopBounds . left ) ;
127- expect ( stopBounds . right ) . toBeLessThanOrEqual ( container . getBoundingClientRect ( ) . right ) ;
128- expect ( stopBounds . bottom ) . toBeLessThanOrEqual ( scrollBounds . bottom ) ;
129- expect ( lastLink . element ( ) . getBoundingClientRect ( ) . top ) . toBeGreaterThan ( scrollBounds . bottom ) ;
130- await firstLink . click ( ) ;
131- expect ( openThread ) . toHaveBeenLastCalledWith ( 1 ) ;
132-
133- viewport . scrollTop = viewport . scrollHeight ;
134- await nextFrame ( ) ;
135- expect ( viewport . scrollTop ) . toBeGreaterThan ( 0 ) ;
136- const lastBounds = lastLink . element ( ) . getBoundingClientRect ( ) ;
137- expect ( lastBounds . top ) . toBeGreaterThanOrEqual ( scrollBounds . top ) ;
138- expect ( lastBounds . bottom ) . toBeLessThanOrEqual ( scrollBounds . bottom + 1 ) ;
139- expect ( stop . element ( ) . getBoundingClientRect ( ) . top ) . toBe ( stopBounds . top ) ;
140- for ( const control of [ lastLink . element ( ) , stop . element ( ) ] ) {
141- const bounds = control . getBoundingClientRect ( ) ;
142- expect (
143- control . contains (
144- document . elementFromPoint ( bounds . x + bounds . width / 2 , bounds . y + bounds . height / 2 ) ,
145- ) ,
146- ) . toBe ( true ) ;
147- }
148- await lastLink . click ( ) ;
149- expect ( openThread ) . toHaveBeenLastCalledWith ( 12 ) ;
150- } ,
151- ) ;
152-
15363it ( "keeps only the usage limit attached while an active goal waits in the collapsible stack" , async ( ) => {
15464 await act ( async ( ) =>
15565 root . render (
0 commit comments