mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Merge pull request #10161 from wibetter/fix-17465
fix(amis): 修正range.test.tsx用例
This commit is contained in:
commit
2b27f6fe12
@ -382,11 +382,12 @@ export class Range extends React.Component<RangeItemProps, any> {
|
||||
*/
|
||||
getStepValue(value: number, step: number) {
|
||||
const surplus = value % step;
|
||||
let curValue = value - surplus;
|
||||
let curValue = 0;
|
||||
const closeNum = value - surplus;
|
||||
// 余数 >= 步长一半 -> 向上取,value为正值的时候,使用 safeAdd,否则使用 safeSub
|
||||
// 余数 < 步长一半 -> 向下取,使用 curValue
|
||||
// 余数 < 步长一半 -> 向下取,使用 closeNum
|
||||
if (Math.abs(surplus) >= step / 2) {
|
||||
curValue = value >= 0 ? safeAdd(curValue, step) : safeSub(curValue, step);
|
||||
curValue = value >= 0 ? safeAdd(closeNum, step) : safeSub(closeNum, step);
|
||||
}
|
||||
/*
|
||||
let result = 0;
|
||||
|
@ -118,7 +118,7 @@ test('EventAction:inputRange', async () => {
|
||||
});
|
||||
|
||||
// 滑动 change
|
||||
const slider = container.querySelector('.cxd-InputRange-handle')!;
|
||||
const slider = container.querySelector('.cxd-InputRange-handle-icon')!;
|
||||
fireEvent.mouseDown(slider);
|
||||
fireEvent.mouseMove(slider, {
|
||||
clientX: 0,
|
||||
|
Loading…
Reference in New Issue
Block a user