mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:48:55 +08:00
fix(amis): 修正range.test.tsx用例
This commit is contained in:
parent
03050bb774
commit
2a4ba1e9e6
@ -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