mirror of
https://github.com/apache/superset.git
synced 2026-05-10 10:25:51 +00:00
chore: Removes direct theme imports (#19368)
This commit is contained in:
committed by
GitHub
parent
d304849b46
commit
816a2c3e1e
@@ -19,7 +19,8 @@
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
import configureStore from 'redux-mock-store';
|
||||
import { shallow } from 'enzyme';
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
||||
import { Menu } from 'src/components/Menu';
|
||||
import {
|
||||
DatasourceModal,
|
||||
@@ -60,8 +61,10 @@ describe('DatasourceControl', () => {
|
||||
...defaultProps,
|
||||
...overrideProps,
|
||||
};
|
||||
return shallow(<DatasourceControl {...props} />, {
|
||||
return mount(<DatasourceControl {...props} />, {
|
||||
context: { store },
|
||||
wrappingComponent: ThemeProvider,
|
||||
wrappingComponentProps: { theme: supersetTheme },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,7 +83,7 @@ describe('DatasourceControl', () => {
|
||||
expect(wrapper.find('[data-test="datasource-menu"]')).toExist();
|
||||
let menuWrapper = shallow(
|
||||
<div>
|
||||
{wrapper.find('[data-test="datasource-menu"]').prop('overlay')}
|
||||
{wrapper.find('[data-test="datasource-menu"]').first().prop('overlay')}
|
||||
</div>,
|
||||
);
|
||||
expect(menuWrapper.find(Menu.Item)).toHaveLength(3);
|
||||
@@ -91,7 +94,7 @@ describe('DatasourceControl', () => {
|
||||
expect(wrapper.find('[data-test="datasource-menu"]')).toExist();
|
||||
menuWrapper = shallow(
|
||||
<div>
|
||||
{wrapper.find('[data-test="datasource-menu"]').prop('overlay')}
|
||||
{wrapper.find('[data-test="datasource-menu"]').first().prop('overlay')}
|
||||
</div>,
|
||||
);
|
||||
expect(menuWrapper.find(Menu.Item)).toHaveLength(2);
|
||||
@@ -113,7 +116,7 @@ describe('DatasourceControl', () => {
|
||||
expect(wrapper.find('[data-test="datasource-menu"]')).toExist();
|
||||
menuWrapper = shallow(
|
||||
<div>
|
||||
{wrapper.find('[data-test="datasource-menu"]').prop('overlay')}
|
||||
{wrapper.find('[data-test="datasource-menu"]').first().prop('overlay')}
|
||||
</div>,
|
||||
);
|
||||
expect(menuWrapper.find(Menu.Item)).toHaveLength(2);
|
||||
|
||||
@@ -33,6 +33,7 @@ const createProps = () => ({
|
||||
default: null,
|
||||
description: null,
|
||||
value: '25__table',
|
||||
form_data: {},
|
||||
datasource: {
|
||||
id: 25,
|
||||
database: {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { t, styled, supersetTheme } from '@superset-ui/core';
|
||||
import { t, styled, withTheme } from '@superset-ui/core';
|
||||
import { getUrlParam } from 'src/utils/urlUtils';
|
||||
|
||||
import { AntdDropdown } from 'src/components';
|
||||
@@ -183,7 +183,7 @@ class DatasourceControl extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const { showChangeDatasourceModal, showEditDatasourceModal } = this.state;
|
||||
const { datasource, onChange } = this.props;
|
||||
const { datasource, onChange, theme } = this.props;
|
||||
const isMissingDatasource = datasource.id == null;
|
||||
let isMissingParams = false;
|
||||
if (isMissingDatasource) {
|
||||
@@ -235,7 +235,7 @@ class DatasourceControl extends React.PureComponent {
|
||||
)}
|
||||
{healthCheckMessage && (
|
||||
<Tooltip title={healthCheckMessage}>
|
||||
<Icons.AlertSolid iconColor={supersetTheme.colors.warning.base} />
|
||||
<Icons.AlertSolid iconColor={theme.colors.warning.base} />
|
||||
</Tooltip>
|
||||
)}
|
||||
{extra?.warning_markdown && (
|
||||
@@ -325,4 +325,4 @@ class DatasourceControl extends React.PureComponent {
|
||||
DatasourceControl.propTypes = propTypes;
|
||||
DatasourceControl.defaultProps = defaultProps;
|
||||
|
||||
export default DatasourceControl;
|
||||
export default withTheme(DatasourceControl);
|
||||
|
||||
Reference in New Issue
Block a user