[js-testing] more tests for SelectControl (#2877)

* rename spec folder

* remove special handling for viz_type control since it now uses VizTypeControl

* add test for getOptions

* linting

* add test for cwp

* linting
This commit is contained in:
Alanna Scott
2017-05-31 10:52:02 -07:00
committed by GitHub
parent 1e7773eb16
commit 90e4d6469d
21 changed files with 80 additions and 52 deletions

View File

@@ -0,0 +1,30 @@
import React from 'react';
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { mount } from 'enzyme';
import { Modal } from 'react-bootstrap';
import ModalTrigger from './../../../../javascripts/components/ModalTrigger';
import DisplayQueryButton from '../../../../javascripts/explore/components/DisplayQueryButton';
describe('DisplayQueryButton', () => {
const defaultProps = {
animation: false,
queryResponse: {
query: 'SELECT * FROM foo',
language: 'sql',
},
chartStatus: 'success',
queryEndpoint: 'localhost',
};
it('is valid', () => {
expect(React.isValidElement(<DisplayQueryButton {...defaultProps} />)).to.equal(true);
});
it('renders a button and a modal', () => {
const wrapper = mount(<DisplayQueryButton {...defaultProps} />);
expect(wrapper.find(ModalTrigger)).to.have.lengthOf(1);
wrapper.find('.modal-trigger').simulate('click');
expect(wrapper.find(Modal)).to.have.lengthOf(1);
});
});