Migrates Button component from Bootstrap to AntD (#12832)

This commit is contained in:
Michael S. Molina
2021-02-01 20:13:10 -03:00
committed by GitHub
parent 51195af4fa
commit c781ab8adf
33 changed files with 605 additions and 558 deletions

View File

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