File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,21 @@ describe('Select.Basic', () => {
5151 inputFilterTest ( 'single' ) ;
5252 openControlledTest ( 'single' ) ;
5353
54+ it ( 'should trigger close event when clicking on Select with open, value and allowClear' , async ( ) => {
55+ const onPopupVisibleChange = jest . fn ( ) ;
56+ const { container } = render (
57+ < Select open value = "1" allowClear onPopupVisibleChange = { onPopupVisibleChange } >
58+ < Option value = "1" > One</ Option >
59+ < Option value = "2" > Two</ Option >
60+ </ Select > ,
61+ ) ;
62+
63+ // Click on the Select should trigger close event
64+ fireEvent . mouseDown ( container . querySelector ( '.rc-select-clear' ) ) ;
65+ await waitFakeTimer ( ) ;
66+ expect ( onPopupVisibleChange ) . toHaveBeenCalledWith ( false ) ;
67+ } ) ;
68+
5469 describe ( 'render' , ( ) => {
5570 function genSelect ( props ?: Partial < SelectProps > ) {
5671 return (
You can’t perform that action at this time.
0 commit comments