import type { TriggerProps, TriggerRef } from '@rc-component/trigger'; import dayjs from 'dayjs'; import customParseFormat from 'dayjs/plugin/customParseFormat'; import React from 'react'; import ConfigProvider from '..'; import { render } from '../../../tests/utils'; import Cascader from '../../cascader'; import Select from '../../select'; import TreeSelect from '../../tree-select'; dayjs.extend(customParseFormat); jest.mock('rc-util/lib/Portal'); function triggerProps(): TriggerProps { return (global as any).triggerProps; } jest.mock('@rc-component/trigger', () => { const R: typeof React = jest.requireActual('react'); const Trigger = jest.requireActual('@rc-component/trigger').default; return R.forwardRef((props, ref) => { (global as any).triggerProps = props; return ; }); }); describe('ConfigProvider.Popup', () => { beforeEach(() => { (global as any).triggerProps = null; }); const selectLikeNodes = ( <> , ); expect(triggerProps().builtinPlacements!.topLeft!.htmlRegion).toBe('scroll'); }); it('TreeSelect', () => { render( , ); expect(triggerProps().builtinPlacements!.topLeft!.htmlRegion).toBe('scroll'); }); it('Cascader', () => { render( , ); expect(triggerProps().builtinPlacements!.topLeft!.htmlRegion).toBe('scroll'); }); }); });