Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion webview-ui/src/components/chat/ChatTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface ChatTextAreaProps {
inputValue: string
setInputValue: (value: string) => void
textAreaDisabled: boolean
selectApiConfigDisabled: boolean
placeholderText: string
selectedImages: string[]
setSelectedImages: React.Dispatch<React.SetStateAction<string[]>>
Expand All @@ -50,6 +51,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
inputValue,
setInputValue,
textAreaDisabled,
selectApiConfigDisabled,
placeholderText,
selectedImages,
setSelectedImages,
Expand Down Expand Up @@ -975,7 +977,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
<div className={cn("flex-1", "min-w-0", "overflow-hidden")}>
<SelectDropdown
value={currentConfigId}
disabled={textAreaDisabled}
disabled={selectApiConfigDisabled}
title={t("chat:selectApiConfig")}
placeholder={displayName} // Always show the current name
options={[
Expand Down
1 change: 1 addition & 0 deletions webview-ui/src/components/chat/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
inputValue={inputValue}
setInputValue={setInputValue}
textAreaDisabled={textAreaDisabled}
selectApiConfigDisabled={textAreaDisabled && clineAsk !== "api_req_failed"}
placeholderText={placeholderText}
selectedImages={selectedImages}
setSelectedImages={setSelectedImages}
Expand Down
18 changes: 18 additions & 0 deletions webview-ui/src/components/chat/__tests__/ChatTextArea.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe("ChatTextArea", () => {
setInputValue: jest.fn(),
onSend: jest.fn(),
textAreaDisabled: false,
selectApiConfigDisabled: false,
onSelectImages: jest.fn(),
shouldDisableImages: false,
placeholderText: "Type a message...",
Expand Down Expand Up @@ -408,4 +409,21 @@ describe("ChatTextArea", () => {
expect(setInputValue).not.toHaveBeenCalled()
})
})

describe("selectApiConfig", () => {
// Helper function to get the API config dropdown
const getApiConfigDropdown = () => {
return screen.getByTitle("chat:selectApiConfig")
}
it("should be enabled independently of textAreaDisabled", () => {
render(<ChatTextArea {...defaultProps} textAreaDisabled={true} selectApiConfigDisabled={false} />)
const apiConfigDropdown = getApiConfigDropdown()
expect(apiConfigDropdown).not.toHaveAttribute("disabled")
})
it("should be disabled when selectApiConfigDisabled is true", () => {
render(<ChatTextArea {...defaultProps} textAreaDisabled={true} selectApiConfigDisabled={true} />)
const apiConfigDropdown = getApiConfigDropdown()
expect(apiConfigDropdown).toHaveAttribute("disabled")
})
})
})
Loading