Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/rc-cli/site/mobile/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export function getLangFromRoute(pathname) {
}

function getRoutes() {
console.log(demos);
const routes = [];
const names = Object.keys(demos);
const langs = locales ? Object.keys(locales) : [];
Expand Down Expand Up @@ -82,7 +81,6 @@ function getRoutes() {
meta: {},
});
}
console.log(routes);

return routes;
}
Expand Down
8 changes: 6 additions & 2 deletions packages/rc-ui-lib/src/datetime-picker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const DatePicker = forwardRef<DateTimePickerInstance, DatePickerProps>((props, r
const pickerRef = useRef<PickerInstance>(null);
const [currentDate, setCurrentDate, currentDateRef] = useRefState(formatValue(value));


const getBoundary = (type: 'max' | 'min', dateValue: Date) => {
const boundary = props[`${type}Date`];
const year = boundary.getFullYear();
Expand Down Expand Up @@ -243,7 +242,12 @@ const DatePicker = forwardRef<DateTimePickerInstance, DatePickerProps>((props, r
};

const onConfirm = () => {
props.onConfirm?.(currentDate);
if (pickerRef.current) {
const indexes = pickerRef.current?.getIndexes();
const nextValue = updateInnerValue(indexes);
setCurrentDate(nextValue);
props.onConfirm?.(nextValue);
}
};

// useMount(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ describe('DatePicker', () => {
onConfirm,
});

await sleep(400);

const confirmBtn = container.querySelector('.rc-picker__confirm');
fireEvent.click(confirmBtn);

Expand All @@ -83,7 +85,7 @@ describe('DatePicker', () => {
await sleep(400);

fireEvent.click(confirmBtn);
// expect(onConfirm.mock.calls[1][0].getMonth()).toEqual(11);
expect(onConfirm.mock.calls[1][0].getMonth()).toEqual(11);
expect(onConfirm.mock.calls[1][0].getDate()).toEqual(1);
});

Expand All @@ -100,9 +102,10 @@ describe('DatePicker', () => {
onConfirm,
});

await sleep(100);

const confirmBtn = container.querySelector('.rc-picker__confirm');
fireEvent.click(confirmBtn);
await sleep(100);
expect(onConfirm.mock.calls[0][0].getFullYear()).toEqual(2020);
expect(onConfirm.mock.calls[0][0].getMonth()).toEqual(10);

Expand Down Expand Up @@ -154,6 +157,8 @@ describe('DatePicker', () => {
onConfirm,
});

await sleep(400);

const confirmBtn = container.querySelector('.rc-picker__confirm');
fireEvent.click(confirmBtn);

Expand Down Expand Up @@ -184,6 +189,8 @@ describe('DatePicker', () => {
onConfirm,
});

await sleep(400);

const confirmBtn = container.querySelector('.rc-picker__confirm');
fireEvent.click(confirmBtn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ describe('DateTimePicker', () => {
onConfirm,
});

await sleep(100);

act(() => {
pickerRef.current.getPicker().setColumnIndex(2, 14);
});
Expand All @@ -132,6 +134,8 @@ describe('DateTimePicker', () => {
onConfirm,
});

await sleep(100);

act(() => {
pickerRef.current.getPicker().setColumnValue(2, '15');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ exports[`Form basic usage 1`] = `
"validateTrigger": "onChange",
}
}
isListField={false}
key="_username"
name={
Array [
Expand Down Expand Up @@ -130,6 +131,7 @@ exports[`Form basic usage 1`] = `
"username",
],
"touched": false,
"validated": false,
"validating": false,
"warnings": Array [],
}
Expand Down Expand Up @@ -457,6 +459,7 @@ exports[`Form when name props is set without shouldUpdate or dependencies 1`] =
"validateTrigger": "onChange",
}
}
isListField={false}
key="_name"
name={
Array [
Expand All @@ -476,6 +479,7 @@ exports[`Form when name props is set without shouldUpdate or dependencies 1`] =
"name",
],
"touched": false,
"validated": false,
"validating": false,
"warnings": Array [],
}
Expand Down Expand Up @@ -824,6 +828,7 @@ exports[`Form when shouldUpdate and dependencies are not set 1`] = `
"validateTrigger": "onChange",
}
}
isListField={false}
key="_"
trigger="onChange"
validateTrigger="onChange"
Expand All @@ -836,6 +841,7 @@ exports[`Form when shouldUpdate and dependencies are not set 1`] = `
"errors": Array [],
"name": Array [],
"touched": false,
"validated": false,
"validating": false,
"warnings": Array [],
}
Expand Down Expand Up @@ -948,6 +954,7 @@ exports[`Form when shouldUpdate props is set 1`] = `
"validateTrigger": "onChange",
}
}
isListField={false}
key="_"
shouldUpdate={true}
trigger="onChange"
Expand All @@ -961,6 +968,7 @@ exports[`Form when shouldUpdate props is set 1`] = `
"errors": Array [],
"name": Array [],
"touched": false,
"validated": false,
"validating": false,
"warnings": Array [],
}
Expand Down
6 changes: 0 additions & 6 deletions packages/rc-ui-lib/src/password-input/PasswordInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ const PasswordInput = forwardRef<PasswordInputInstance, PasswordInputProps>((pro
},
}));

const onTouchStart = (event) => {
event.stopPropagation();
props.onFocus?.();
};

const renderPoints = () => {
const Points: JSX.Element[] = [];
const { mask, gutter } = props;
Expand Down Expand Up @@ -114,7 +109,6 @@ const PasswordInput = forwardRef<PasswordInputInstance, PasswordInputProps>((pro
>
<ul
className={classNames(bem('security'), { [BORDER_SURROUND]: !props.gutter })}
onTouchStart={onTouchStart}
>
{renderPoints()}
</ul>
Expand Down
24 changes: 12 additions & 12 deletions packages/rc-ui-lib/src/password-input/__test__/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ describe('PasswordInput', () => {
jest.restoreAllMocks();
});

it('should emit onFocus event when security is touched', async () => {
const onFocus = jest.fn();
const props = {
...$props,
onFocus,
};

const { container } = createPasswordInput(props);
const wrapper = container.querySelector('.rc-password-input__security');
await TestsEvent.triggerTouch(wrapper, 'touchstart', [[0, 0]]);
expect(onFocus).toHaveBeenCalled();
});
// it('should emit onFocus event when security is touched', async () => {
// const onFocus = jest.fn();
// const props = {
// ...$props,
// onFocus,
// };

// const { container } = createPasswordInput(props);
// const wrapper = container.querySelector('.rc-password-input__security');
// await TestsEvent.triggerTouch(wrapper, 'touchstart', [[0, 0]]);
// expect(onFocus).toHaveBeenCalled();
// });

it('should emit onFocus event when wrapper is focused', async () => {
const onFocus = jest.fn();
Expand Down
Loading