test: js => ts (#39642)

This commit is contained in:
lijianan 2022-12-19 13:31:41 +08:00 committed by GitHub
parent ba999de764
commit 3276e7b75c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 10 deletions

View File

@ -1,6 +0,0 @@
function copy(str, options = {}) {
copy.lastStr = str;
copy.lastOptions = options;
}
export default copy;

View File

@ -0,0 +1,9 @@
const copy: ((str?: string, options?: object) => void) & {
lastStr?: string;
lastOptions?: object;
} = (str: string, options = {}) => {
copy.lastStr = str;
copy.lastOptions = options;
};
export default copy;

View File

@ -1,9 +1,12 @@
import * as React from 'react';
import Trigger from 'rc-trigger/lib/mock';
import type { TriggerProps } from 'rc-trigger';
import { TriggerMockContext } from '../shared/demoTestContext';
export default React.forwardRef((props, ref) => {
const ForwardTrigger = React.forwardRef<any, TriggerProps>((props, ref) => {
const mergedPopupVisible = React.useContext(TriggerMockContext) ?? props.popupVisible;
global.triggerProps = props;
return <Trigger {...props} ref={ref} popupVisible={mergedPopupVisible} />;
(global as any).triggerProps = props;
return <Trigger {...props} ref={ref} popupVisible={mergedPopupVisible as boolean} />;
});
export default ForwardTrigger;

View File

@ -1,6 +1,8 @@
import React from 'react';
export default class Portal extends React.Component {
class Portal extends React.Component<{ children?: React.ReactNode }> {
container: boolean;
componentDidMount() {
this.createContainer();
}
@ -18,3 +20,5 @@ export default class Portal extends React.Component {
return null;
}
}
export default Portal;