type: ts definition improvement (#50324)

* type: improve type assert

* type: improve type assert

* chore: modify the path
pull/50333/head^2
thinkasany 6 months ago committed by GitHub
parent 96a06943a5
commit 7085ab39d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -37,8 +37,8 @@ const AffixMounter: React.FC<AffixProps> = (props) => {
};
describe('Affix Render', () => {
rtlTest(Affix as any);
accessibilityTest(Affix as any);
rtlTest(() => <Affix>test</Affix>);
accessibilityTest(() => <Affix>test</Affix>);
const domMock = jest.spyOn(HTMLElement.prototype, 'getBoundingClientRect');

@ -4,6 +4,8 @@ exports[`Affix Render rtl render component should be rendered correctly in RTL d
<div>
<div
class=""
/>
>
test
</div>
</div>
`;

@ -2,9 +2,10 @@ import React, { useState } from 'react';
import { fireEvent, render } from '../../../tests/utils';
import Sider from '../Sider';
import type { Breakpoint } from '../..';
const Content = () => {
const [breakpoint, setBreakpoint] = useState('sm');
const [breakpoint, setBreakpoint] = useState<Breakpoint>('sm');
const toggleBreakpoint = () => {
if (breakpoint === 'sm') {
setBreakpoint('lg');
@ -13,7 +14,7 @@ const Content = () => {
}
};
return (
<Sider breakpoint={breakpoint as any}>
<Sider breakpoint={breakpoint}>
<button type="button" id="toggle" onClick={toggleBreakpoint}>
Toggle
</button>

@ -22,9 +22,9 @@ function waitRaf() {
describe('Tag', () => {
mountTest(Tag);
mountTest(Tag.CheckableTag as any);
mountTest(() => <Tag.CheckableTag checked={false} />);
rtlTest(Tag);
rtlTest(Tag.CheckableTag as any);
rtlTest(() => <Tag.CheckableTag checked={false} />);
beforeAll(() => {
jest.useFakeTimers();

@ -131,18 +131,14 @@ describe('Typography', () => {
expect(container.querySelector('.ant-tooltip-inner')?.textContent).toBe('Copy');
} else if (tooltips === false) {
expect(container.querySelector('.ant-tooltip-inner')).toBeFalsy();
} else if ((tooltips as any)[0] === '' && (tooltips as any)[1] === '') {
} else if (tooltips[0] === '' && tooltips[1] === '') {
expect(container.querySelector('.ant-tooltip-inner')).toBeFalsy();
} else if ((tooltips as any)[0] === '' && (tooltips as any)[1]) {
} else if (tooltips[0] === '' && tooltips[1]) {
expect(container.querySelector('.ant-tooltip-inner')).toBeFalsy();
} else if ((tooltips as any)[1] === '' && (tooltips as any)[0]) {
expect(container.querySelector('.ant-tooltip-inner')?.textContent).toBe(
(tooltips as any)[0],
);
} else if (tooltips[1] === '' && tooltips[0]) {
expect(container.querySelector('.ant-tooltip-inner')?.textContent).toBe(tooltips[0]);
} else {
expect(container.querySelector('.ant-tooltip-inner')?.textContent).toBe(
(tooltips as any)[0],
);
expect(container.querySelector('.ant-tooltip-inner')?.textContent).toBe(tooltips[0]);
}
// Click to copy

@ -23,7 +23,7 @@ const props: UploadProps = {
ctx.textBaseline = 'middle';
ctx.font = '33px Arial';
ctx.fillText('Ant Design', 20, 20);
canvas.toBlob((result) => resolve(result as any));
canvas.toBlob((result) => resolve(result as Blob));
};
};
});

Loading…
Cancel
Save