Files
superset2/superset/assets/spec/javascripts/explorev2/components/DisplayQueryButton_spec.jsx
Alanna Scott 0c9f9b695b [clarity/consistency] rename /explorev2/ -> /explore/ (#2802)
* rename /explorev2/ -> /explore/

* add redirect for existing explorev2 urls

* fix long line

* remove extra line

* fix missed ref in spec
2017-05-24 17:12:28 -07:00

31 lines
995 B
JavaScript

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);
});
});