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.

29 lines
996 B

import React from 'react';
import TestUtils from 'react-addons-test-utils';
jest.dontMock('../components/popover/index');
const Popover = require('../components/popover/index');
describe('Popover', function() {
it('should show overlay when trigger is clicked', () => {
const popover = TestUtils.renderIntoDocument(
<Popover overlay="console.log('hello world')" title="code" trigger="click">
<a href="#">show me your code</a>
</Popover>
);
9 years ago
expect(popover.getPopupDomNode()).toBe(undefined);
TestUtils.Simulate.click(
TestUtils.findRenderedDOMComponentWithTag(popover, 'a')
);
const popup = popover.getPopupDomNode();
9 years ago
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>/);
});
});