Renaming field to control (#2210)

This commit is contained in:
Maxime Beauchemin
2017-02-22 08:36:47 -08:00
committed by GitHub
parent d5ba88b407
commit 1e47d6fb41
30 changed files with 415 additions and 411 deletions

View File

@@ -0,0 +1,31 @@
/* 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 CheckboxControl from '../../../../javascripts/explorev2/components/controls/CheckboxControl';
const defaultProps = {
name: 'show_legend',
onChange: sinon.spy(),
};
describe('CheckboxControl', () => {
let wrapper;
beforeEach(() => {
wrapper = shallow(<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;
});
});