@@ -55,7 +55,9 @@ vi.mock('../../hooks/useAiUsage', () => ({
5555 useAiUsage : ( ) => ( { usage : null , isLoading : false , error : undefined , refetch : ( ) => { } } ) ,
5656} ) ) ;
5757
58- // What the default body reports to the chrome; `report` re-reports it.
58+ // What the default body reports to the chrome; `report` re-reports it. The
59+ // report lands in an effect after the body mounts, so a case waits for the
60+ // header's + (drawn from the report), never for the body alone.
5961const bodyState : { actions : ChatDockConversationActions | undefined ; report ?: ( a : ChatDockConversationActions | undefined ) => void } = {
6062 actions : undefined ,
6163} ;
@@ -126,7 +128,7 @@ describe('the drawer header ☆ (objectstack#37863)', () => {
126128 it ( 'the rail: ☆ leads the buttons once the thread exists' , async ( ) => {
127129 bodyState . actions = SENT ;
128130 renderRail ( ) ;
129- await screen . findByTestId ( 'default -dock-body ' ) ;
131+ await screen . findByTestId ( 'chat -dock-new ' ) ;
130132 expect ( headerControls ( ) ) . toEqual ( [ 'Add to favorites' , 'New conversation' , 'History' , 'More actions' , 'Close' ] ) ;
131133 const star = screen . getByTestId ( 'chat-dock-favorite' ) ;
132134 expect ( star ) . toHaveAttribute ( 'aria-pressed' , 'false' ) ;
@@ -136,15 +138,15 @@ describe('the drawer header ☆ (objectstack#37863)', () => {
136138 it ( 'before the first send there is no ☆' , async ( ) => {
137139 bodyState . actions = { showDebug : false , startNew : ( ) => { } , agent : 'ask' } ;
138140 renderRail ( ) ;
139- await screen . findByTestId ( 'default -dock-body ' ) ;
141+ await screen . findByTestId ( 'chat -dock-new ' ) ;
140142 expect ( screen . queryByTestId ( 'chat-dock-favorite' ) ) . toBeNull ( ) ;
141143 expect ( headerControls ( ) ) . toEqual ( [ 'New conversation' , 'History' , 'More actions' , 'Close' ] ) ;
142144 } ) ;
143145
144146 it ( '☆ stores the thread as a conversation favourite, pressed while it is one; pressed again, removes it' , async ( ) => {
145147 bodyState . actions = { ...SENT , agent : 'data_chat' } ;
146148 renderRail ( ) ;
147- await screen . findByTestId ( 'default -dock-body ' ) ;
149+ await screen . findByTestId ( 'chat -dock-new ' ) ;
148150 fireEvent . click ( screen . getByTestId ( 'chat-dock-favorite' ) ) ;
149151 expect ( stored ( ) ) . toEqual ( [
150152 expect . objectContaining ( {
@@ -168,7 +170,7 @@ describe('the drawer header ☆ (objectstack#37863)', () => {
168170 it ( 'starred while the label is still read, it is stored as "New conversation" and then takes the label' , async ( ) => {
169171 bodyState . actions = { ...SENT , label : undefined , labelPending : true } ;
170172 renderRail ( ) ;
171- await screen . findByTestId ( 'default -dock-body ' ) ;
173+ await screen . findByTestId ( 'chat -dock-new ' ) ;
172174 fireEvent . click ( screen . getByTestId ( 'chat-dock-favorite' ) ) ;
173175 expect ( stored ( ) [ 0 ] . label ) . toBe ( 'New conversation' ) ;
174176 act ( ( ) => bodyState . report ?.( { ...SENT , label : 'Quarterly revenue' } ) ) ;
@@ -184,7 +186,7 @@ describe('the drawer header ☆ (objectstack#37863)', () => {
184186 ) ;
185187 bodyState . actions = { ...SENT , label : undefined , labelPending : true } ;
186188 renderRail ( ) ;
187- await screen . findByTestId ( 'default -dock-body ' ) ;
189+ await screen . findByTestId ( 'chat -dock-new ' ) ;
188190 expect ( screen . getByTestId ( 'chat-dock-favorite' ) ) . toHaveAttribute ( 'aria-pressed' , 'true' ) ;
189191 expect ( stored ( ) [ 0 ] . label ) . toBe ( 'old words' ) ;
190192 act ( ( ) => bodyState . report ?.( SENT ) ) ;
@@ -194,15 +196,15 @@ describe('the drawer header ☆ (objectstack#37863)', () => {
194196 it ( 'control: a thread that is not a favourite is written nowhere' , async ( ) => {
195197 bodyState . actions = SENT ;
196198 renderRail ( ) ;
197- await screen . findByTestId ( 'default -dock-body ' ) ;
199+ await screen . findByTestId ( 'chat -dock-new ' ) ;
198200 act ( ( ) => bodyState . report ?.( { ...SENT , label : 'Renamed' } ) ) ;
199201 expect ( stored ( ) ) . toEqual ( [ ] ) ;
200202 } ) ;
201203
202204 it ( 'the full window draws ☆ too' , async ( ) => {
203205 bodyState . actions = SENT ;
204206 renderRail ( { fullWindow : true } ) ;
205- await screen . findByTestId ( 'default -dock-body ' ) ;
207+ await screen . findByTestId ( 'chat -dock-new ' ) ;
206208 expect ( headerControls ( ) ) . toEqual ( [ 'Add to favorites' , 'New conversation' , 'More actions' , 'Close' ] ) ;
207209 } ) ;
208210
@@ -213,7 +215,7 @@ describe('the drawer header ☆ (objectstack#37863)', () => {
213215 < ChatDockMobileSheet open onOpenChange = { ( ) => { } } />
214216 </ FavoritesProvider > ,
215217 ) ;
216- await screen . findByTestId ( 'default -dock-body ' ) ;
218+ await screen . findByTestId ( 'chat -dock-mobile-new ' ) ;
217219 const sheet = screen . getByTestId ( 'chat-dock-mobile-sheet' ) ;
218220 const names = Array . from ( sheet . querySelectorAll ( 'button' ) ) . map ( ( b ) => b . getAttribute ( 'aria-label' ) ?? b . textContent ?. trim ( ) ?? '' ) ;
219221 expect ( names . slice ( 0 , 4 ) ) . toEqual ( [ 'Add to favorites' , 'New conversation' , 'History' , 'More actions' ] ) ;
0 commit comments