mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 19:50:05 +08:00
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import TestUtils from 'react-addons-test-utils';
|
|
|
|
jest.dontMock('../components/popover/placements');
|
|
jest.dontMock('../components/popover/index');
|
|
jest.dontMock('../components/tooltip/index');
|
|
|
|
const Popover = require('../components/popover/index');
|
|
|
|
describe('Popover', function() {
|
|
it('should show overlay when trigger is clicked', () => {
|
|
const popover = TestUtils.renderIntoDocument(
|
|
<Popover content="console.log('hello world')" title="code" trigger="click">
|
|
<a href="#">show me your code</a>
|
|
</Popover>
|
|
);
|
|
|
|
expect(popover.getPopupDomNode()).toBe(undefined);
|
|
|
|
TestUtils.Simulate.click(
|
|
TestUtils.findRenderedDOMComponentWithTag(popover, 'a')
|
|
);
|
|
|
|
const popup = popover.getPopupDomNode();
|
|
expect(popup).not.toBe(undefined);
|
|
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>/);
|
|
});
|
|
});
|