mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
test: js => ts (#39642)
This commit is contained in:
parent
ba999de764
commit
3276e7b75c
@ -1,6 +0,0 @@
|
||||
function copy(str, options = {}) {
|
||||
copy.lastStr = str;
|
||||
copy.lastOptions = options;
|
||||
}
|
||||
|
||||
export default copy;
|
9
tests/__mocks__/copy-to-clipboard.ts
Normal file
9
tests/__mocks__/copy-to-clipboard.ts
Normal 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;
|
@ -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;
|
@ -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;
|
Loading…
Reference in New Issue
Block a user