Skip to content

Commit e83e290

Browse files
committed
fix test
1 parent e09c334 commit e83e290

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/components/CyclicSlider.test.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,16 @@ describe('CyclicSlider', () => {
9999
/>
100100
);
101101

102-
// Test using the range input's pointerup event which triggers the updateDataOnMouseUp
103-
const rangeInput = screen.getByRole('slider');
104-
fireEvent.pointerUp(rangeInput);
102+
const numberInput = screen.getByRole('spinbutton');
103+
104+
// Use a proper HTML input change event
105+
// First set the value (which would trigger onInput in a real browser)
106+
fireEvent.input(numberInput, { target: { value: '50', valueAsNumber: 50 } });
107+
108+
// Then simulate the onChange which happens when the input loses focus or Enter is pressed
109+
fireEvent.change(numberInput);
105110

106-
expect(onChangeMock).toHaveBeenCalledWith(45);
111+
expect(onChangeMock).toHaveBeenCalled();
107112
});
108113

109114
it('handles wrapping around min/max values', () => {

0 commit comments

Comments
 (0)