mirror of
https://github.com/apache/superset.git
synced 2026-04-10 11:55:24 +00:00
* Change in files * Renamin files and folders * cleaning up a single piece of lint * Removing boat picture from docs * add superset word mark * Update rename note in docs * Fixing images * Pinning datatables * Fixing issues with mapbox-gl * Forgot to rename one file * Linting * v0.13.0 * adding pyyaml to dev-reqs
32 lines
877 B
JavaScript
32 lines
877 B
JavaScript
/* eslint-disable no-unused-expressions */
|
|
import React from 'react';
|
|
import { Checkbox } from 'react-bootstrap';
|
|
import sinon from 'sinon';
|
|
import { expect } from 'chai';
|
|
import { describe, it, beforeEach } from 'mocha';
|
|
import { shallow } from 'enzyme';
|
|
import CheckboxField from '../../../../javascripts/explorev2/components/CheckboxField';
|
|
|
|
const defaultProps = {
|
|
name: 'show_legend',
|
|
onChange: sinon.spy(),
|
|
};
|
|
|
|
describe('CheckboxField', () => {
|
|
let wrapper;
|
|
|
|
beforeEach(() => {
|
|
wrapper = shallow(<CheckboxField {...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('show_legend')).to.be.true;
|
|
});
|
|
});
|