mirror of
https://github.com/apache/superset.git
synced 2026-04-13 13:18:25 +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
34 lines
942 B
JavaScript
34 lines
942 B
JavaScript
/* eslint-disable no-unused-expressions */
|
|
import React from 'react';
|
|
import { FormControl } from 'react-bootstrap';
|
|
import sinon from 'sinon';
|
|
import { expect } from 'chai';
|
|
import { describe, it, beforeEach } from 'mocha';
|
|
import { shallow } from 'enzyme';
|
|
import SelectField from '../../../../javascripts/explorev2/components/SelectField';
|
|
|
|
const defaultProps = {
|
|
choices: [[10, 10], [20, 20]],
|
|
name: 'row_limit',
|
|
label: 'Row Limit',
|
|
onChange: sinon.spy(),
|
|
};
|
|
|
|
describe('SelectField', () => {
|
|
let wrapper;
|
|
|
|
beforeEach(() => {
|
|
wrapper = shallow(<SelectField {...defaultProps} />);
|
|
});
|
|
|
|
it('renders a FormControl', () => {
|
|
expect(wrapper.find(FormControl)).to.have.lengthOf(1);
|
|
});
|
|
|
|
it('calls onChange when toggled', () => {
|
|
const select = wrapper.find(FormControl);
|
|
select.simulate('change', { target: { value: 50 } });
|
|
expect(defaultProps.onChange.calledWith('row_limit', 50)).to.be.true;
|
|
});
|
|
});
|