mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
refactor: Refactor QueryTable to use react-table (#11216)
* Refactor QueryTable to use react-table * Fix lodash import * Fix tests * Fix imports and QuerySearch styles * Update superset-frontend/src/SqlLab/components/QuerySearch.jsx Co-authored-by: Evan Rusackas <evan@preset.io> * Update superset-frontend/src/SqlLab/components/QuerySearch.jsx Co-authored-by: Evan Rusackas <evan@preset.io> * Lint fix * Refactored QueryTable into functional component * Remove calculating content height * Lint fix Co-authored-by: Evan Rusackas <evan@preset.io>
This commit is contained in:
committed by
GitHub
parent
a1f8429b4e
commit
735123d1f5
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { Table } from 'reactable-arc';
|
||||
import QueryTable from 'src/SqlLab/components/QueryTable';
|
||||
|
||||
import TableView from 'src/components/TableView';
|
||||
import { TableCollection } from 'src/components/dataViewCommon';
|
||||
import { queries } from './fixtures';
|
||||
|
||||
describe('QueryTable', () => {
|
||||
@@ -35,10 +35,14 @@ describe('QueryTable', () => {
|
||||
});
|
||||
it('renders a proper table', () => {
|
||||
const wrapper = shallow(<QueryTable {...mockedProps} />);
|
||||
expect(wrapper.find(Table)).toExist();
|
||||
expect(wrapper.find(Table).shallow().find('table')).toExist();
|
||||
expect(wrapper.find(Table).shallow().find('table').find('Tr')).toHaveLength(
|
||||
2,
|
||||
);
|
||||
const tableWrapper = wrapper
|
||||
.find(TableView)
|
||||
.shallow()
|
||||
.find(TableCollection)
|
||||
.shallow();
|
||||
expect(wrapper.find(TableView)).toExist();
|
||||
expect(tableWrapper.find('table')).toExist();
|
||||
expect(tableWrapper.find('table').find('thead').find('tr')).toHaveLength(1);
|
||||
expect(tableWrapper.find('table').find('tbody').find('tr')).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user