test: js => ts (#39642)
parent
ba999de764
commit
3276e7b75c
@ -1,6 +0,0 @@
|
||||
function copy(str, options = {}) {
|
||||
copy.lastStr = str;
|
||||
copy.lastOptions = options;
|
||||
}
|
||||
|
||||
export default copy;
|
@ -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;
|
Loading…
Reference in New Issue