@@ -1057,4 +1057,70 @@ describe("ChatTextArea", () => {
10571057 expect ( apiConfigDropdown ) . toHaveAttribute ( "disabled" )
10581058 } )
10591059 } )
1060+
1061+ describe ( "send button visibility" , ( ) => {
1062+ it ( "should show send button when there are images but no text" , ( ) => {
1063+ const { container } = render (
1064+ < ChatTextArea
1065+ { ...defaultProps }
1066+ inputValue = ""
1067+ selectedImages = { [ "data:image/png;base64,test1" , "data:image/png;base64,test2" ] }
1068+ /> ,
1069+ )
1070+
1071+ // Find the send button by its icon
1072+ const sendButton = container . querySelector ( 'button[aria-label="Send message"]' )
1073+ expect ( sendButton ) . toBeInTheDocument ( )
1074+
1075+ // Check that the button is visible (has opacity-100 class when content exists)
1076+ expect ( sendButton ) . toHaveClass ( "opacity-100" )
1077+ expect ( sendButton ) . toHaveClass ( "pointer-events-auto" )
1078+ expect ( sendButton ) . not . toHaveClass ( "opacity-0" )
1079+ expect ( sendButton ) . not . toHaveClass ( "pointer-events-none" )
1080+ } )
1081+
1082+ it ( "should hide send button when there is no text and no images" , ( ) => {
1083+ const { container } = render ( < ChatTextArea { ...defaultProps } inputValue = "" selectedImages = { [ ] } /> )
1084+
1085+ // Find the send button by its icon
1086+ const sendButton = container . querySelector ( 'button[aria-label="Send message"]' )
1087+ expect ( sendButton ) . toBeInTheDocument ( )
1088+
1089+ // Check that the button is hidden (has opacity-0 class when no content)
1090+ expect ( sendButton ) . toHaveClass ( "opacity-0" )
1091+ expect ( sendButton ) . toHaveClass ( "pointer-events-none" )
1092+ expect ( sendButton ) . not . toHaveClass ( "opacity-100" )
1093+ expect ( sendButton ) . not . toHaveClass ( "pointer-events-auto" )
1094+ } )
1095+
1096+ it ( "should show send button when there is text but no images" , ( ) => {
1097+ const { container } = render ( < ChatTextArea { ...defaultProps } inputValue = "Some text" selectedImages = { [ ] } /> )
1098+
1099+ // Find the send button by its icon
1100+ const sendButton = container . querySelector ( 'button[aria-label="Send message"]' )
1101+ expect ( sendButton ) . toBeInTheDocument ( )
1102+
1103+ // Check that the button is visible
1104+ expect ( sendButton ) . toHaveClass ( "opacity-100" )
1105+ expect ( sendButton ) . toHaveClass ( "pointer-events-auto" )
1106+ } )
1107+
1108+ it ( "should show send button when there is both text and images" , ( ) => {
1109+ const { container } = render (
1110+ < ChatTextArea
1111+ { ...defaultProps }
1112+ inputValue = "Some text"
1113+ selectedImages = { [ "data:image/png;base64,test1" ] }
1114+ /> ,
1115+ )
1116+
1117+ // Find the send button by its icon
1118+ const sendButton = container . querySelector ( 'button[aria-label="Send message"]' )
1119+ expect ( sendButton ) . toBeInTheDocument ( )
1120+
1121+ // Check that the button is visible
1122+ expect ( sendButton ) . toHaveClass ( "opacity-100" )
1123+ expect ( sendButton ) . toHaveClass ( "pointer-events-auto" )
1124+ } )
1125+ } )
10601126} )
0 commit comments