mirror of
https://github.com/apache/superset.git
synced 2026-04-10 20:06:13 +00:00
35 lines
998 B
JavaScript
35 lines
998 B
JavaScript
import React from 'react';
|
|
import { expect } from 'chai';
|
|
import { describe, it } from 'mocha';
|
|
import { shallow } from 'enzyme';
|
|
|
|
import PopoverSection from '../../../javascripts/components/PopoverSection';
|
|
|
|
describe('PopoverSection', () => {
|
|
const defaultProps = {
|
|
title: 'Section Title',
|
|
isSelected: true,
|
|
onSelect: () => {},
|
|
info: 'info section',
|
|
children: <div />,
|
|
};
|
|
|
|
let wrapper;
|
|
const factory = (overrideProps) => {
|
|
const props = Object.assign({}, defaultProps, overrideProps || {});
|
|
return shallow(<PopoverSection {...props} />);
|
|
};
|
|
beforeEach(() => {
|
|
wrapper = factory();
|
|
});
|
|
it('renders', () => {
|
|
expect(React.isValidElement(<PopoverSection {...defaultProps} />)).to.equal(true);
|
|
});
|
|
it('is show an icon when selected', () => {
|
|
expect(wrapper.find('.fa-check')).to.have.length(1);
|
|
});
|
|
it('is show no icon when not selected', () => {
|
|
expect(factory({ isSelected: false }).find('.fa-check')).to.have.length(0);
|
|
});
|
|
});
|