mirror of https://github.com/apache/superset.git
chore(superset-ui-core and NoResultsComponent): Migrate to RTL, add RTL modules to the ui-core (#28187)
This commit is contained in:
parent
2e5f3ed851
commit
601896b1fc
|
@ -73,6 +73,10 @@
|
||||||
"@emotion/cache": "^11.4.0",
|
"@emotion/cache": "^11.4.0",
|
||||||
"@emotion/react": "^11.4.1",
|
"@emotion/react": "^11.4.1",
|
||||||
"@emotion/styled": "^11.3.0",
|
"@emotion/styled": "^11.3.0",
|
||||||
|
"@testing-library/dom": "^7.29.4",
|
||||||
|
"@testing-library/jest-dom": "^5.11.6",
|
||||||
|
"@testing-library/react": "^11.2.0",
|
||||||
|
"@testing-library/user-event": "^12.7.0",
|
||||||
"@types/react": "*",
|
"@types/react": "*",
|
||||||
"@types/react-loadable": "*",
|
"@types/react-loadable": "*",
|
||||||
"@types/tinycolor2": "*",
|
"@types/tinycolor2": "*",
|
||||||
|
|
|
@ -18,18 +18,25 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { render, screen } from '@testing-library/react';
|
||||||
import { configure } from '@superset-ui/core';
|
import '@testing-library/jest-dom';
|
||||||
|
import { ThemeProvider, supersetTheme } from '../../../src/style';
|
||||||
import NoResultsComponent from '../../../src/chart/components/NoResultsComponent';
|
import NoResultsComponent from '../../../src/chart/components/NoResultsComponent';
|
||||||
|
|
||||||
configure();
|
const renderNoResultsComponent = () =>
|
||||||
|
render(
|
||||||
|
<ThemeProvider theme={supersetTheme}>
|
||||||
|
<NoResultsComponent height="400" width="300" />
|
||||||
|
</ThemeProvider>,
|
||||||
|
);
|
||||||
|
|
||||||
describe('NoResultsComponent', () => {
|
test('renders the no results error', () => {
|
||||||
it('renders the no results error', () => {
|
renderNoResultsComponent();
|
||||||
const wrapper = shallow(<NoResultsComponent height="400" width="300" />);
|
|
||||||
|
|
||||||
expect(wrapper.text()).toEqual(
|
expect(screen.getByText(/No Results/)).toBeInTheDocument();
|
||||||
'No ResultsNo results were returned for this query. If you expected results to be returned, ensure any filters are configured properly and the datasource contains data for the selected time range.',
|
expect(
|
||||||
);
|
screen.getByText(
|
||||||
});
|
'No results were returned for this query. If you expected results to be returned, ensure any filters are configured properly and the datasource contains data for the selected time range.',
|
||||||
|
),
|
||||||
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue