You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
903 B
26 lines
903 B
8 years ago
|
import React from 'react';
|
||
|
import TestUtils from 'react-addons-test-utils';
|
||
|
import Popover from '..';
|
||
|
|
||
|
describe('Popover', () => {
|
||
|
it('should show overlay when trigger is clicked', () => {
|
||
|
const popover = TestUtils.renderIntoDocument(
|
||
|
<Popover content="console.log('hello world')" title="code" trigger="click">
|
||
|
<span>show me your code</span>
|
||
|
</Popover>
|
||
|
);
|
||
|
|
||
|
expect(popover.getPopupDomNode()).toBe(null);
|
||
|
|
||
|
TestUtils.Simulate.click(
|
||
|
TestUtils.findRenderedDOMComponentWithTag(popover, 'span')
|
||
|
);
|
||
|
|
||
|
const popup = popover.getPopupDomNode();
|
||
|
expect(popup).not.toBe(null);
|
||
|
expect(popup.className).toContain('ant-popover-placement-top');
|
||
|
expect(popup.innerHTML).toMatch(/<div class="ant-popover-title".*?>code<\/div>/);
|
||
|
expect(popup.innerHTML).toMatch(/<div class="ant-popover-inner-content".*?>console\.log\('hello world'\)<\/div>/);
|
||
|
});
|
||
|
});
|