fix: Upload don't support Popover (#25090)

close #25077
This commit is contained in:
偏右 2020-06-19 10:59:21 +08:00 committed by GitHub
parent a421d6fca3
commit 2b4d049921
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -528,4 +528,22 @@ describe('Upload', () => {
const wrapper = mount(<Upload listType="picture-card" fileList={[file]} />);
expect(wrapper.find('img').length).toBe(0);
});
// https://github.com/ant-design/ant-design/issues/25077
it('should support events', () => {
const onClick = jest.fn();
const onMouseEnter = jest.fn();
const onMouseLeave = jest.fn();
const wrapper = mount(
<Upload onClick={onClick} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
<button type="button">upload</button>
</Upload>,
);
wrapper.find('.ant-upload').at(1).simulate('click');
expect(onClick).toHaveBeenCalled();
wrapper.find('.ant-upload').at(1).simulate('mouseEnter');
expect(onMouseEnter).toHaveBeenCalled();
wrapper.find('.ant-upload').at(1).simulate('mouseLeave');
expect(onMouseLeave).toHaveBeenCalled();
});
});

View File

@ -141,7 +141,7 @@
"rc-tree": "~3.3.0",
"rc-tree-select": "~4.0.0",
"rc-trigger": "~4.3.0",
"rc-upload": "~3.1.0",
"rc-upload": "~3.2.0",
"rc-util": "^5.0.1",
"scroll-into-view-if-needed": "^2.2.25",
"warning": "^4.0.3"