Files
superset2/superset/assets/spec/javascripts/explore/components/RunQueryActionButton_spec.jsx
Prashant 7a497e2f6b [sql_lab]Disabled run query button if sql query editor is empty (#4728)
* Disabled run query button if sql query editor is empty

* Removing unnecessary white space

* Fix failing test for sql props

* Adding sql variable into propTypes and defaultProps
2018-04-03 14:58:23 -07:00

36 lines
944 B
JavaScript

import React from 'react';
import { expect } from 'chai';
import { describe, it, beforeEach } from 'mocha';
import { shallow } from 'enzyme';
import RunQueryActionButton
from '../../../../javascripts/SqlLab/components/RunQueryActionButton';
import Button from '../../../../javascripts/components/Button';
describe('RunQueryActionButton', () => {
let wrapper;
const defaultProps = {
allowAsync: false,
dbId: 1,
queryState: 'pending',
runQuery: () => {}, // eslint-disable-line
selectedText: null,
stopQuery: () => {}, // eslint-disable-line
sql: '',
};
beforeEach(() => {
wrapper = shallow(<RunQueryActionButton {...defaultProps} />);
});
it('is a valid react element', () => {
expect(
React.isValidElement(<RunQueryActionButton {...defaultProps} />),
).to.equal(true);
});
it('renders a single Button', () => {
expect(wrapper.find(Button)).to.have.lengthOf(1);
});
});