mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: ensure slider always displays valid value (min 2) for concurrent file reads
- Fix issue where slider could display values below minimum when enabled with maxConcurrentFileReads <= 1 - Add test cases for edge cases (value 0 and 1) - Ensure UI always shows at least the minimum value of 2
This commit is contained in:
parent
105aef70b1
commit
4da7b79684
2 changed files with 33 additions and 2 deletions
|
|
@ -55,11 +55,11 @@ export const ConcurrentFileReadsExperiment = ({
|
|||
min={2}
|
||||
max={100}
|
||||
step={1}
|
||||
value={[maxConcurrentFileReads]}
|
||||
value={[Math.max(2, maxConcurrentFileReads)]}
|
||||
onValueChange={([value]) => onMaxConcurrentFileReadsChange(value)}
|
||||
data-testid="max-concurrent-file-reads-slider"
|
||||
/>
|
||||
<span className="w-10 text-sm">{maxConcurrentFileReads}</span>
|
||||
<span className="w-10 text-sm">{Math.max(2, maxConcurrentFileReads)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -138,4 +138,35 @@ describe("ConcurrentFileReadsExperiment", () => {
|
|||
// Verify new value is displayed
|
||||
expect(screen.getByText("50")).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("should display minimum value of 2 when maxConcurrentFileReads is less than 2", () => {
|
||||
render(
|
||||
<ConcurrentFileReadsExperiment
|
||||
enabled={true}
|
||||
onEnabledChange={mockOnEnabledChange}
|
||||
maxConcurrentFileReads={1}
|
||||
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
|
||||
/>,
|
||||
)
|
||||
|
||||
// Should display 2 (minimum value) instead of 1
|
||||
expect(screen.getByText("2")).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("should set maxConcurrentFileReads to 15 when enabling with value of 0", () => {
|
||||
render(
|
||||
<ConcurrentFileReadsExperiment
|
||||
enabled={false}
|
||||
onEnabledChange={mockOnEnabledChange}
|
||||
maxConcurrentFileReads={0}
|
||||
onMaxConcurrentFileReadsChange={mockOnMaxConcurrentFileReadsChange}
|
||||
/>,
|
||||
)
|
||||
|
||||
const checkbox = screen.getByTestId("concurrent-file-reads-checkbox")
|
||||
fireEvent.click(checkbox)
|
||||
|
||||
expect(mockOnEnabledChange).toHaveBeenCalledWith(true)
|
||||
expect(mockOnMaxConcurrentFileReadsChange).toHaveBeenCalledWith(15)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue