mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
Added different Select Fields (#1583)
* Added different Select Fields - Switched FormGroup to react-select - Added multi and freeform to select, now it can take customized user input and insert it as options * Fixed tests * Small nit based on comments
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
import React from 'react';
|
||||
import { FormControl } from 'react-bootstrap';
|
||||
import Select, { Creatable } from 'react-select';
|
||||
import sinon from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, beforeEach } from 'mocha';
|
||||
@@ -21,13 +21,18 @@ describe('SelectField', () => {
|
||||
wrapper = shallow(<SelectField {...defaultProps} />);
|
||||
});
|
||||
|
||||
it('renders a FormControl', () => {
|
||||
expect(wrapper.find(FormControl)).to.have.lengthOf(1);
|
||||
it('renders a Select', () => {
|
||||
expect(wrapper.find(Select)).to.have.lengthOf(1);
|
||||
});
|
||||
|
||||
it('calls onChange when toggled', () => {
|
||||
const select = wrapper.find(FormControl);
|
||||
select.simulate('change', { target: { value: 50 } });
|
||||
const select = wrapper.find(Select);
|
||||
select.simulate('change', { value: 50 });
|
||||
expect(defaultProps.onChange.calledWith('row_limit', 50)).to.be.true;
|
||||
});
|
||||
|
||||
it('renders a Creatable for freeform', () => {
|
||||
wrapper = shallow(<SelectField {...defaultProps} freeForm />);
|
||||
expect(wrapper.find(Creatable)).to.have.lengthOf(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user