2016-12-14 14:48:09 +08:00
|
|
|
import React from 'react';
|
2017-07-07 20:26:08 +08:00
|
|
|
import { mount } from 'enzyme';
|
2016-12-14 14:48:09 +08:00
|
|
|
import Popover from '..';
|
|
|
|
|
|
|
|
describe('Popover', () => {
|
|
|
|
it('should show overlay when trigger is clicked', () => {
|
2017-07-07 20:26:08 +08:00
|
|
|
const popover = mount(
|
2016-12-14 14:48:09 +08:00
|
|
|
<Popover content="console.log('hello world')" title="code" trigger="click">
|
|
|
|
<span>show me your code</span>
|
|
|
|
</Popover>
|
|
|
|
);
|
|
|
|
|
2017-07-07 20:26:08 +08:00
|
|
|
expect(popover.node.getPopupDomNode()).toBe(null);
|
2016-12-14 14:48:09 +08:00
|
|
|
|
2017-07-07 20:26:08 +08:00
|
|
|
popover.find('span').simulate('click');
|
2016-12-14 14:48:09 +08:00
|
|
|
|
2017-07-07 20:26:08 +08:00
|
|
|
const popup = popover.node.getPopupDomNode();
|
2016-12-14 14:48:09 +08:00
|
|
|
expect(popup).not.toBe(null);
|
|
|
|
expect(popup.className).toContain('ant-popover-placement-top');
|
2017-07-07 20:26:08 +08:00
|
|
|
expect(popup.innerHTML).toMatchSnapshot();
|
|
|
|
expect(popup.innerHTML).toMatchSnapshot();
|
2016-12-14 14:48:09 +08:00
|
|
|
});
|
|
|
|
});
|