@@ -15,6 +15,9 @@ function createState(overrides: Partial<AppViewState> = {}) {
1515 return {
1616 connected : true ,
1717 chatLoading : false ,
18+ chatRunId : null ,
19+ chatSending : false ,
20+ chatStream : null ,
1821 onboarding : false ,
1922 sessionKey : "main" ,
2023 sessionsHideCron : true ,
@@ -49,6 +52,17 @@ function createState(overrides: Partial<AppViewState> = {}) {
4952 } as unknown as AppViewState ;
5053}
5154
55+ function renderRefreshButton ( overrides : Partial < AppViewState > = { } ) {
56+ const container = document . createElement ( "div" ) ;
57+ render ( renderChatControls ( createState ( overrides ) ) , container ) ;
58+
59+ const button = container . querySelector < HTMLButtonElement > (
60+ `.chat-controls .btn--icon[data-tooltip="${ t ( "chat.refreshTitle" ) } "]` ,
61+ ) ;
62+ expect ( button ) . not . toBeNull ( ) ;
63+ return button ! ;
64+ }
65+
5266describe ( "chat header controls (browser)" , ( ) => {
5367 it ( "renders explicit hover tooltip metadata for the top-right action buttons" , async ( ) => {
5468 const container = document . createElement ( "div" ) ;
@@ -76,6 +90,19 @@ describe("chat header controls (browser)", () => {
7690 }
7791 } ) ;
7892
93+ it . each ( [
94+ [ "connected and idle" , { } , false ] ,
95+ [ "chat history loading" , { chatLoading : true } , true ] ,
96+ [ "chat send in flight" , { chatSending : true } , true ] ,
97+ [ "active run" , { chatRunId : "run-123" } , true ] ,
98+ [ "active stream" , { chatStream : "streaming" } , true ] ,
99+ [ "disconnected" , { connected : false } , true ] ,
100+ ] as const ) ( "sets refresh disabled state while %s" , ( _name , overrides , disabled ) => {
101+ const button = renderRefreshButton ( overrides ) ;
102+
103+ expect ( button . disabled ) . toBe ( disabled ) ;
104+ } ) ;
105+
79106 it ( "renders the cron session filter in the mobile dropdown controls" , async ( ) => {
80107 const state = createState ( {
81108 sessionsResult : {
0 commit comments