Skip to content

Commit ec4bc8d

Browse files
committed
wip
1 parent ec10507 commit ec4bc8d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

webview-ui/src/components/settings/ContextManagementSettings.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ export const ContextManagementSettings = ({
276276
<VSCodeTextArea
277277
resize="vertical"
278278
value={customCondensingPrompt || SUMMARY_PROMPT}
279-
data-testid="custom-condensing-prompt-textarea"
280279
onChange={(e) => {
281280
const value = (e.target as HTMLTextAreaElement).value
282281
setCachedStateField("customCondensingPrompt", value)
@@ -292,7 +291,6 @@ export const ContextManagementSettings = ({
292291
<Button
293292
variant="secondary"
294293
size="sm"
295-
data-testid="custom-condensing-prompt-reset"
296294
onClick={() => {
297295
setCachedStateField("customCondensingPrompt", SUMMARY_PROMPT)
298296
vscode.postMessage({

webview-ui/src/components/settings/__tests__/ContextManagementSettings.test.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ describe("ContextManagementSettings", () => {
210210
it("toggles auto condense context setting", () => {
211211
const mockSetCachedStateField = jest.fn()
212212
const props = { ...autoCondenseProps, setCachedStateField: mockSetCachedStateField }
213-
render(<ContextManagementSettings {...props} />)
213+
const { rerender } = render(<ContextManagementSettings {...props} />)
214214

215215
const checkbox = screen.getByTestId("auto-condense-context-checkbox")
216216
expect(checkbox).toBeChecked()
@@ -219,19 +219,22 @@ describe("ContextManagementSettings", () => {
219219
fireEvent.click(checkbox)
220220
expect(mockSetCachedStateField).toHaveBeenCalledWith("autoCondenseContext", false)
221221

222+
// Re-render with updated props to simulate the state change
223+
rerender(<ContextManagementSettings {...props} autoCondenseContext={false} />)
224+
222225
// Additional settings should not be visible when disabled
223226
expect(screen.queryByTestId("auto-condense-percent-slider")).not.toBeInTheDocument()
224-
expect(screen.queryByTestId("condensing-api-config-select")).not.toBeInTheDocument()
225-
expect(screen.queryByTestId("custom-condensing-prompt-textarea")).not.toBeInTheDocument()
227+
expect(screen.queryByRole("combobox")).not.toBeInTheDocument()
228+
expect(screen.queryByRole("textbox")).not.toBeInTheDocument()
226229
})
227230

228231
it("shows additional settings when auto condense is enabled", () => {
229232
render(<ContextManagementSettings {...autoCondenseProps} />)
230233

231234
// Additional settings should be visible
232235
expect(screen.getByTestId("auto-condense-percent-slider")).toBeInTheDocument()
233-
expect(screen.getByTestId("condensing-api-config-select")).toBeInTheDocument()
234-
expect(screen.getByTestId("custom-condensing-prompt-textarea")).toBeInTheDocument()
236+
expect(screen.getByRole("combobox")).toBeInTheDocument()
237+
expect(screen.getByRole("textbox")).toBeInTheDocument()
235238
})
236239

237240
it("hides additional settings when auto condense is disabled", () => {
@@ -240,8 +243,8 @@ describe("ContextManagementSettings", () => {
240243

241244
// Additional settings should not be visible
242245
expect(screen.queryByTestId("auto-condense-percent-slider")).not.toBeInTheDocument()
243-
expect(screen.queryByTestId("condensing-api-config-select")).not.toBeInTheDocument()
244-
expect(screen.queryByTestId("custom-condensing-prompt-textarea")).not.toBeInTheDocument()
246+
expect(screen.queryByRole("combobox")).not.toBeInTheDocument()
247+
expect(screen.queryByRole("textbox")).not.toBeInTheDocument()
245248
})
246249

247250
it("updates auto condense context percent", () => {

0 commit comments

Comments
 (0)