From 331d28f69d5b6741885a6b7b5135a22399dacb5c Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Thu, 30 Nov 2023 11:30:27 +0800 Subject: [PATCH] chore: test case --- tests/Slider.test.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/Slider.test.js b/tests/Slider.test.js index c993ce263..71a57c7b4 100644 --- a/tests/Slider.test.js +++ b/tests/Slider.test.js @@ -188,13 +188,21 @@ describe('Slider', () => { it('decreases the value when key "left" is pressed', () => { const onChange = jest.fn(); - const { container } = render(); + const onChangeComplete = jest.fn(); + const { container } = render(); fireEvent.keyDown(container.getElementsByClassName('rc-slider-handle')[0], { keyCode: keyCode.LEFT, }); expect(onChange).toHaveBeenCalledWith(49); + expect(onChangeComplete).not.toHaveBeenCalled(); + + fireEvent.keyUp(container.getElementsByClassName('rc-slider-handle')[0], { + keyCode: keyCode.LEFT, + }); + + expect(onChangeComplete).toHaveBeenCalled(); }); it('it should work fine when arrow key is pressed', () => {