@@ -1115,20 +1115,24 @@ describe("ChatView - Focus Grabbing Tests", () => {
11151115describe ( "ChatView - Version Indicator Tests" , ( ) => {
11161116 beforeEach ( ( ) => vi . clearAllMocks ( ) )
11171117
1118- it ( "displays version indicator button" , ( ) => {
1119- // Temporarily override the mock for this test
1120- mockVersionIndicator . mockImplementation ( ( props ?: { onClick ?: ( ) => void ; className ?: string } ) => {
1118+ // Helper function to create a mock VersionIndicator implementation
1119+ const createMockVersionIndicator = (
1120+ ariaLabel : string = "chat:versionIndicator.ariaLabel" ,
1121+ version : string = "v3.21.5" ,
1122+ ) => {
1123+ return ( props ?: { onClick ?: ( ) => void ; className ?: string } ) => {
11211124 const { onClick, className } = props || { }
11221125 return (
1123- < button
1124- data-testid = "version-indicator"
1125- onClick = { onClick }
1126- className = { className }
1127- aria-label = "chat:versionIndicator.ariaLabel" >
1128- v3.21.5
1126+ < button data-testid = "version-indicator" onClick = { onClick } className = { className } aria-label = { ariaLabel } >
1127+ { version }
11291128 </ button >
11301129 )
1131- } )
1130+ }
1131+ }
1132+
1133+ it ( "displays version indicator button" , ( ) => {
1134+ // Temporarily override the mock for this test
1135+ mockVersionIndicator . mockImplementation ( createMockVersionIndicator ( ) )
11321136
11331137 const { getByLabelText } = renderChatView ( )
11341138
@@ -1148,18 +1152,7 @@ describe("ChatView - Version Indicator Tests", () => {
11481152
11491153 it ( "opens announcement modal when version indicator is clicked" , ( ) => {
11501154 // Temporarily override the mock for this test
1151- mockVersionIndicator . mockImplementation ( ( props ?: { onClick ?: ( ) => void ; className ?: string } ) => {
1152- const { onClick, className } = props || { }
1153- return (
1154- < button
1155- data-testid = "version-indicator"
1156- onClick = { onClick }
1157- className = { className }
1158- aria-label = "Version 3.22.5" >
1159- v3.22.5
1160- </ button >
1161- )
1162- } )
1155+ mockVersionIndicator . mockImplementation ( createMockVersionIndicator ( "Version 3.22.5" , "v3.22.5" ) )
11631156
11641157 const { getByTestId } = renderChatView ( )
11651158
@@ -1182,18 +1175,7 @@ describe("ChatView - Version Indicator Tests", () => {
11821175
11831176 it ( "version indicator has correct styling classes" , ( ) => {
11841177 // Temporarily override the mock for this test
1185- mockVersionIndicator . mockImplementation ( ( props ?: { onClick ?: ( ) => void ; className ?: string } ) => {
1186- const { onClick, className } = props || { }
1187- return (
1188- < button
1189- data-testid = "version-indicator"
1190- onClick = { onClick }
1191- className = { className }
1192- aria-label = "Version 3.22.5" >
1193- v3.22.5
1194- </ button >
1195- )
1196- } )
1178+ mockVersionIndicator . mockImplementation ( createMockVersionIndicator ( "Version 3.22.5" , "v3.22.5" ) )
11971179
11981180 const { getByTestId } = renderChatView ( )
11991181
@@ -1214,18 +1196,7 @@ describe("ChatView - Version Indicator Tests", () => {
12141196
12151197 it ( "version indicator has proper accessibility attributes" , ( ) => {
12161198 // Temporarily override the mock for this test
1217- mockVersionIndicator . mockImplementation ( ( props ?: { onClick ?: ( ) => void ; className ?: string } ) => {
1218- const { onClick, className } = props || { }
1219- return (
1220- < button
1221- data-testid = "version-indicator"
1222- onClick = { onClick }
1223- className = { className }
1224- aria-label = "Version 3.22.5" >
1225- v3.22.5
1226- </ button >
1227- )
1228- } )
1199+ mockVersionIndicator . mockImplementation ( createMockVersionIndicator ( "Version 3.22.5" , "v3.22.5" ) )
12291200
12301201 const { getByTestId } = renderChatView ( )
12311202
@@ -1265,18 +1236,7 @@ describe("ChatView - Version Indicator Tests", () => {
12651236
12661237 it ( "displays version indicator only on welcome screen (no task)" , ( ) => {
12671238 // Temporarily override the mock for this test
1268- mockVersionIndicator . mockImplementation ( ( props ?: { onClick ?: ( ) => void ; className ?: string } ) => {
1269- const { onClick, className } = props || { }
1270- return (
1271- < button
1272- data-testid = "version-indicator"
1273- onClick = { onClick }
1274- className = { className }
1275- aria-label = "Version 3.22.5" >
1276- v3.22.5
1277- </ button >
1278- )
1279- } )
1239+ mockVersionIndicator . mockImplementation ( createMockVersionIndicator ( "Version 3.22.5" , "v3.22.5" ) )
12801240
12811241 const { queryByTestId, rerender } = renderChatView ( )
12821242
0 commit comments