@@ -222,7 +222,7 @@ describe("ChatTextArea", () => {
222222 expect ( mockExecCommand ) . toHaveBeenCalledWith ( "insertText" , false , "Enhanced test prompt" )
223223 } )
224224
225- it ( "should fallback to setRangeText when execCommand is not available" , ( ) => {
225+ it ( "should fallback to setInputValue when execCommand is not available" , ( ) => {
226226 const setInputValue = vi . fn ( )
227227
228228 // Mock document.execCommand to be undefined (not available)
@@ -231,23 +231,7 @@ describe("ChatTextArea", () => {
231231 writable : true ,
232232 } )
233233
234- const { container } = render (
235- < ChatTextArea { ...defaultProps } setInputValue = { setInputValue } inputValue = "Original prompt" /> ,
236- )
237-
238- const textarea = container . querySelector ( "textarea" ) !
239-
240- // Mock textarea methods
241- const mockSelect = vi . fn ( )
242- const mockFocus = vi . fn ( )
243- const mockSetRangeText = vi . fn ( )
244- const mockDispatchEvent = vi . fn ( )
245-
246- textarea . select = mockSelect
247- textarea . focus = mockFocus
248- textarea . setRangeText = mockSetRangeText
249- textarea . dispatchEvent = mockDispatchEvent
250- textarea . value = "Original prompt"
234+ render ( < ChatTextArea { ...defaultProps } setInputValue = { setInputValue } inputValue = "Original prompt" /> )
251235
252236 // Simulate receiving enhanced prompt message
253237 window . dispatchEvent (
@@ -259,10 +243,8 @@ describe("ChatTextArea", () => {
259243 } ) ,
260244 )
261245
262- // Verify fallback methods were used
263- expect ( mockFocus ) . toHaveBeenCalled ( )
264- expect ( mockSetRangeText ) . toHaveBeenCalledWith ( "Enhanced test prompt" , 0 , 15 , "select" ) // 15 is length of "Original prompt"
265- expect ( mockDispatchEvent ) . toHaveBeenCalledWith ( expect . any ( Event ) )
246+ // Verify fallback to setInputValue was used
247+ expect ( setInputValue ) . toHaveBeenCalledWith ( "Enhanced test prompt" )
266248 } )
267249
268250 it ( "should not crash when textarea ref is not available" , ( ) => {
0 commit comments