mirror of
https://github.com/apache/superset.git
synced 2026-04-14 05:34:38 +00:00
Migrates Button component from Bootstrap to AntD (#12832)
This commit is contained in:
committed by
GitHub
parent
51195af4fa
commit
c781ab8adf
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { styledMount as mount } from 'spec/helpers/theming';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import QueryAndSaveButtons from 'src/explore/components/QueryAndSaveBtns';
|
||||
@@ -38,23 +38,21 @@ describe('QueryAndSaveButtons', () => {
|
||||
|
||||
// Test the output
|
||||
describe('output', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<QueryAndSaveButtons {...defaultProps} />);
|
||||
});
|
||||
const wrapper = mount(<QueryAndSaveButtons {...defaultProps} />);
|
||||
|
||||
it('renders 2 buttons', () => {
|
||||
expect(wrapper.find(Button)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('renders buttons with correct text', () => {
|
||||
expect(wrapper.find(Button).contains('Run')).toBe(true);
|
||||
expect(wrapper.find(Button).contains('Save')).toBe(true);
|
||||
expect(wrapper.find(Button).at(0).text().trim()).toBe('Run');
|
||||
expect(wrapper.find(Button).at(1).text().trim()).toBe('Save');
|
||||
});
|
||||
|
||||
it('calls onQuery when query button is clicked', () => {
|
||||
const queryButton = wrapper.find('[data-test="run-query-button"]');
|
||||
const queryButton = wrapper
|
||||
.find('[data-test="run-query-button"]')
|
||||
.hostNodes();
|
||||
queryButton.simulate('click');
|
||||
expect(defaultProps.onQuery.called).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user