mirror of
https://github.com/apache/superset.git
synced 2026-04-16 06:34:52 +00:00
[sql lab] only show single run query button (#1858)
* only show single run query button, allow async if possible * only pass the needed props, rather than entire objects to the component * add simple test * fix linting
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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
|
||||
};
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user