mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-02 15:59:38 +08:00
eac30ec8e4
* feat: remove warnings for linkRender, nameRender in Breadcrumb * feat: remove warnings for onOpen, onClose in Menu * feat: remove warnings for overlay in Popover * feat: remove warnings for columnsPageRange, columnsPageSize in Table * feat: remove warnings for afterClose in Tag * feat: remove warnings for notFoundContent, searchPlaceholder, body, onSearchChange in Transfer * fix: types in Transfer * feat: update test cases in Transfer * feat: add additional test cases for removed deprecated apis
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import Popover from '..';
|
|
|
|
describe('Popover', () => {
|
|
it('should show overlay when trigger is clicked', () => {
|
|
const popover = mount(
|
|
<Popover content="console.log('hello world')" title="code" trigger="click">
|
|
<span>show me your code</span>
|
|
</Popover>,
|
|
);
|
|
|
|
expect(popover.instance().getPopupDomNode()).toBe(null);
|
|
|
|
popover.find('span').simulate('click');
|
|
|
|
const popup = popover.instance().getPopupDomNode();
|
|
expect(popup).not.toBe(null);
|
|
expect(popup.className).toContain('ant-popover-placement-top');
|
|
expect(popup.innerHTML).toMatchSnapshot();
|
|
expect(popup.innerHTML).toMatchSnapshot();
|
|
});
|
|
|
|
it('props#overlay do not warn anymore', () => {
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
|
|
const overlay = jest.fn();
|
|
mount(
|
|
<Popover content="console.log('hello world')" title="code" trigger="click">
|
|
<span>show me your code</span>
|
|
</Popover>,
|
|
);
|
|
|
|
expect(errorSpy.mock.calls.length).toBe(0);
|
|
expect(overlay).not.toHaveBeenCalled();
|
|
});
|
|
});
|