Skip to content

Commit

Permalink
test: update jest snapshot and fix type (ant-design#44652)
Browse files Browse the repository at this point in the history
* test: update jest snapshot

* type: fix setTimeout ReturnType
  • Loading branch information
afc163 authored Sep 6, 2023
1 parent 843c4b6 commit 09a6f3c
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 151 deletions.
2 changes: 1 addition & 1 deletion components/_util/ActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ActionButton: React.FC<ActionButtonProps> = (props) => {
};

React.useEffect(() => {
let timeoutId: NodeJS.Timer | null = null;
let timeoutId: ReturnType<typeof setTimeout> | null = null;
if (props.autoFocus) {
timeoutId = setTimeout(() => {
ref.current?.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
5 changes: 1 addition & 4 deletions components/badge/__tests__/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,11 @@ exports[`renders ./components/drawer/demo/form-in-drawer.md extend context corre
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
5 changes: 1 addition & 4 deletions components/drawer/__tests__/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,11 @@ exports[`renders ./components/drawer/demo/form-in-drawer.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
31 changes: 7 additions & 24 deletions components/form/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5089,14 +5089,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -5706,14 +5703,11 @@ exports[`renders ./components/form/demo/dynamic-form-item.md extend context corr
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand All @@ -5740,14 +5734,11 @@ exports[`renders ./components/form/demo/dynamic-form-item.md extend context corr
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -5830,14 +5821,11 @@ exports[`renders ./components/form/demo/dynamic-form-items.md extend context cor
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -6092,14 +6080,11 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md extend con
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -6207,14 +6192,11 @@ exports[`renders ./components/form/demo/dynamic-form-items-no-style.md extend co
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -19733,6 +19715,7 @@ exports[`renders ./components/form/demo/validate-other.md extend context correct
>
<ul
class="ant-rate"
id="validate_other_rate"
role="radiogroup"
tabindex="0"
>
Expand Down
31 changes: 7 additions & 24 deletions components/form/__tests__/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2572,14 +2572,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3189,14 +3186,11 @@ exports[`renders ./components/form/demo/dynamic-form-item.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand All @@ -3223,14 +3217,11 @@ exports[`renders ./components/form/demo/dynamic-form-item.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3313,14 +3304,11 @@ exports[`renders ./components/form/demo/dynamic-form-items.md correctly 1`] = `
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3493,14 +3481,11 @@ exports[`renders ./components/form/demo/dynamic-form-items-complex.md correctly
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -3608,14 +3593,11 @@ exports[`renders ./components/form/demo/dynamic-form-items-no-style.md correctly
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -8723,6 +8705,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
>
<ul
class="ant-rate"
id="validate_other_rate"
role="radiogroup"
tabindex="0"
>
Expand Down
4 changes: 2 additions & 2 deletions components/input/hooks/useRemovePasswordTimeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function useRemovePasswordTimeout(
inputRef: React.RefObject<InputRef>,
triggerOnMount?: boolean,
) {
const removePasswordTimeoutRef = useRef<NodeJS.Timer[]>([]);
const removePasswordTimeoutRef = useRef<ReturnType<typeof setTimeout>[]>([]);
const removePasswordTimeout = () => {
removePasswordTimeoutRef.current.push(
setTimeout(() => {
Expand All @@ -26,7 +26,7 @@ export default function useRemovePasswordTimeout(
}

return () =>
removePasswordTimeoutRef.current.forEach(timer => {
removePasswordTimeoutRef.current.forEach((timer) => {
if (timer) {
clearTimeout(timer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -677,14 +674,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
10 changes: 2 additions & 8 deletions components/progress/__tests__/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down Expand Up @@ -677,14 +674,11 @@ Array [
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1683,14 +1683,11 @@ exports[`renders ./components/select/demo/custom-dropdown-menu.md extend context
viewBox="64 64 896 896"
width="1em"
>
<defs>
<style />
</defs>
<path
d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"
/>
<path
d="M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"
d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"
/>
</svg>
</span>
Expand Down
4 changes: 2 additions & 2 deletions components/statistic/Countdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ function getTime(value?: countdownValueType) {
return new Date(value as valueType).getTime();
}

const Countdown: React.FC<CountdownProps> = props => {
const Countdown: React.FC<CountdownProps> = (props) => {
const { value, format = 'HH:mm:ss', onChange, onFinish } = props;

const forceUpdate = useForceUpdate();

const countdown = React.useRef<NodeJS.Timer | null>(null);
const countdown = React.useRef<ReturnType<typeof setTimeout> | null>(null);

const stopTimer = () => {
onFinish?.();
Expand Down
Loading

0 comments on commit 09a6f3c

Please sign in to comment.