Skip to content

Commit b611747

Browse files
test(grid-view): improve test coverage and accessibility
Co-Authored-By: tjiang@box.com <tjiang@box.com>
1 parent ede06ac commit b611747

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/grid-view/__tests__/GridViewSlider.test.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,16 @@ describe('components/grid-view/GridViewSlider', () => {
3030
expect(screen.queryByRole('slider')).not.toBeInTheDocument();
3131
});
3232

33-
test('should call onChange when slider value changes', () => {
33+
test('should call onChange when clicking increase/decrease buttons', () => {
3434
const onChange = jest.fn();
3535
renderComponent({ onChange });
36-
const slider = screen.getByRole('slider');
37-
expect(slider).toBeInTheDocument();
38-
fireEvent.change(slider, { target: { value: '5' } });
36+
const increaseButton = screen.getByRole('button', { name: 'Increase column size' });
37+
const decreaseButton = screen.getByRole('button', { name: 'Decrease column size' });
38+
expect(increaseButton).toBeInTheDocument();
39+
expect(decreaseButton).toBeInTheDocument();
40+
fireEvent.click(increaseButton);
3941
expect(onChange).toHaveBeenCalled();
42+
fireEvent.click(decreaseButton);
43+
expect(onChange).toHaveBeenCalledTimes(2);
4044
});
4145
});

0 commit comments

Comments
 (0)