mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
[explore] viz type selector as modal (#2787)
* [explore] viz type selector as modal * Addressing comments * Adressing comments
This commit is contained in:
committed by
GitHub
parent
3a4cd3ae24
commit
66403f1876
@@ -0,0 +1,37 @@
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, beforeEach } from 'mocha';
|
||||
import { shallow } from 'enzyme';
|
||||
import { Modal } from 'react-bootstrap';
|
||||
import VizTypeControl from '../../../../javascripts/explore/components/controls/VizTypeControl';
|
||||
|
||||
const defaultProps = {
|
||||
name: 'viz_type',
|
||||
label: 'Visualization Type',
|
||||
value: 'table',
|
||||
onChange: sinon.spy(),
|
||||
};
|
||||
|
||||
describe('VizTypeControl', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<VizTypeControl {...defaultProps} />);
|
||||
});
|
||||
|
||||
it('renders a Modal', () => {
|
||||
expect(wrapper.find(Modal)).to.have.lengthOf(1);
|
||||
});
|
||||
|
||||
it('calls onChange when toggled', () => {
|
||||
const select = wrapper.find('.viztype-selector-container').first();
|
||||
select.simulate('click');
|
||||
expect(defaultProps.onChange.called).to.equal(true);
|
||||
});
|
||||
it('filters images based on text input', () => {
|
||||
expect(wrapper.find('img').length).to.be.above(20);
|
||||
wrapper.setState({ filter: 'time' });
|
||||
expect(wrapper.find('img').length).to.be.below(10);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user