mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
Improving TextAreaControl to support code and modal (#2988)
This commit is contained in:
committed by
GitHub
parent
b9915e7ecf
commit
7e5e229f48
@@ -5,6 +5,8 @@ import sinon from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, beforeEach } from 'mocha';
|
||||
import { shallow } from 'enzyme';
|
||||
import AceEditor from 'react-ace';
|
||||
|
||||
import TextAreaControl from '../../../../javascripts/explore/components/controls/TextAreaControl';
|
||||
|
||||
const defaultProps = {
|
||||
@@ -15,7 +17,6 @@ const defaultProps = {
|
||||
|
||||
describe('SelectControl', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<TextAreaControl {...defaultProps} />);
|
||||
});
|
||||
@@ -29,4 +30,12 @@ describe('SelectControl', () => {
|
||||
select.simulate('change', { target: { value: 'x' } });
|
||||
expect(defaultProps.onChange.calledWith('x')).to.be.true;
|
||||
});
|
||||
|
||||
it('renders a AceEditor when language is specified', () => {
|
||||
const props = Object.assign({}, defaultProps);
|
||||
props.language = 'markdown';
|
||||
wrapper = shallow(<TextAreaControl {...props} />);
|
||||
expect(wrapper.find(FormControl)).to.have.lengthOf(0);
|
||||
expect(wrapper.find(AceEditor)).to.have.lengthOf(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user