Skip to content

Commit 20f2e40

Browse files
committed
test(Slider): add onChangeCommit test cases
1 parent 715cb70 commit 20f2e40

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

packages/reshaped/src/components/Slider/tests/Slider.stories.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ export const defaultValue: StoryObj<{
208208

209209
expect(args.handleChange).toHaveBeenCalledTimes(1);
210210
expect(args.handleChange).toHaveBeenCalledWith({ value: 51, name: "test-name" });
211+
212+
expect(args.handleChangeCommit).toHaveBeenCalledTimes(1);
213+
expect(args.handleChangeCommit).toHaveBeenCalledWith({ value: 51, name: "test-name" });
214+
211215
expect(input).toHaveValue("51");
212216
},
213217
};
@@ -240,6 +244,10 @@ export const value: StoryObj<{
240244

241245
expect(args.handleChange).toHaveBeenCalledTimes(1);
242246
expect(args.handleChange).toHaveBeenCalledWith({ value: 51, name: "test-name" });
247+
248+
expect(args.handleChangeCommit).toHaveBeenCalledTimes(1);
249+
expect(args.handleChangeCommit).toHaveBeenCalledWith({ value: 51, name: "test-name" });
250+
243251
expect(input).toHaveValue("50");
244252
},
245253
};
@@ -282,6 +290,15 @@ export const rangeDefaultValue: StoryObj<{
282290
maxName: "test-name",
283291
});
284292

293+
expect(args.handleChangeCommit).toHaveBeenCalledTimes(1);
294+
expect(args.handleChangeCommit).toHaveBeenCalledWith({
295+
minValue: 51,
296+
maxValue: 70,
297+
name: "test-name",
298+
minName: "test-name",
299+
maxName: "test-name",
300+
});
301+
285302
expect(minInput).toHaveValue("51");
286303
expect(maxInput).toHaveValue("70");
287304
},
@@ -325,6 +342,14 @@ export const rangeValue: StoryObj<{
325342
maxName: "test-name-max",
326343
});
327344

345+
expect(args.handleChangeCommit).toHaveBeenCalledTimes(1);
346+
expect(args.handleChangeCommit).toHaveBeenCalledWith({
347+
minValue: 51,
348+
maxValue: 70,
349+
minName: "test-name-min",
350+
maxName: "test-name-max",
351+
});
352+
328353
expect(minInput).toHaveValue("50");
329354
expect(maxInput).toHaveValue("70");
330355
},

0 commit comments

Comments
 (0)