mirror of
https://github.com/apache/superset.git
synced 2026-04-10 11:55:24 +00:00
Get query button working in explorev2 (#1581)
* Get query buttonw working in explorev2 - Create new endpoint for updating explore viz - Send over new form_data when query button is pressed * Added endpoint test * Changes based on comments * Added docstring for endpoint, and query spec * Remove white space around docstring
This commit is contained in:
@@ -2,13 +2,14 @@ import React from 'react';
|
||||
import { beforeEach, describe, it } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { shallow } from 'enzyme';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import QueryAndSaveButtons from '../../../../javascripts/explore/components/QueryAndSaveBtns';
|
||||
|
||||
describe('QueryAndSaveButtons', () => {
|
||||
const defaultProps = {
|
||||
canAdd: 'True',
|
||||
onQuery: () => {},
|
||||
onQuery: sinon.spy(),
|
||||
};
|
||||
|
||||
// It must render
|
||||
@@ -32,5 +33,11 @@ describe('QueryAndSaveButtons', () => {
|
||||
expect(wrapper.find('button').contains(' Query')).to.eql(true);
|
||||
expect(wrapper.find('button').contains(' Save as')).to.eql(true);
|
||||
});
|
||||
|
||||
it('calls onQuery when query button is clicked', () => {
|
||||
const queryButton = wrapper.find('#query_button');
|
||||
queryButton.simulate('click');
|
||||
expect(defaultProps.onQuery.called).to.eql(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user