mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
[explore] include ControlHeader as part of Control interface (#2809)
* [explore] include ControlHeader as part of Control interface * Adressing comments
This commit is contained in:
committed by
GitHub
parent
0c9f9b695b
commit
4d12251806
@@ -4,29 +4,24 @@ import { Checkbox } from 'react-bootstrap';
|
||||
import sinon from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, beforeEach } from 'mocha';
|
||||
import { shallow } from 'enzyme';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import CheckboxControl from '../../../../javascripts/explore/components/controls/CheckboxControl';
|
||||
|
||||
const defaultProps = {
|
||||
name: 'show_legend',
|
||||
onChange: sinon.spy(),
|
||||
value: false,
|
||||
};
|
||||
|
||||
describe('CheckboxControl', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<CheckboxControl {...defaultProps} />);
|
||||
wrapper = mount(<CheckboxControl {...defaultProps} />);
|
||||
});
|
||||
|
||||
it('renders a Checkbox', () => {
|
||||
expect(wrapper.find(Checkbox)).to.have.lengthOf(1);
|
||||
});
|
||||
|
||||
it('calls onChange when toggled', () => {
|
||||
const checkbox = wrapper.find(Checkbox);
|
||||
checkbox.simulate('change', { value: true });
|
||||
expect(defaultProps.onChange.calledWith(true)).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user