michael-s-molina commented on a change in pull request #17025:
URL: https://github.com/apache/superset/pull/17025#discussion_r724924009
##########
File path:
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.tsx
##########
@@ -74,7 +81,19 @@ const FilterControl: React.FC<FilterProps> = ({
<StyledFilterControlTitleBox>
<StyledFilterControlTitle data-test="filter-control-name">
{name}
- </StyledFilterControlTitle>
+ </StyledFilterControlTitle>{' '}
+ {!!filter.description && (
+ <ToolTipContainer
+ data-test="filter-description"
Review comment:
Can you avoid the use of `data-test` and access the element using any
other way? You can check [RTL
Priority](https://testing-library.com/docs/queries/about/#priority) to see the
possibilities.
##########
File path:
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CascadeFilters/CascadeFilterControl/CascadeFilterControl.test.tsx
##########
@@ -55,22 +55,38 @@ const setup = (props: CascadeFilterControlProps) => (
);
test('should render', () => {
- const { container } = render(setup(mockedProps));
+ const { container } = render(setup(mockedProps()));
expect(container).toBeInTheDocument();
});
test('should render the filter name', () => {
- render(setup(mockedProps));
+ render(setup(mockedProps()));
expect(screen.getByText('test')).toBeInTheDocument();
});
test('should render the children filter names', () => {
- render(setup(mockedProps));
+ render(setup(mockedProps()));
expect(screen.getByText('test child filter 1')).toBeInTheDocument();
expect(screen.getByText('test child filter 2')).toBeInTheDocument();
});
test('should render the child of a child filter name', () => {
- render(setup(mockedProps));
+ render(setup(mockedProps()));
expect(screen.getByText('test child of a child filter')).toBeInTheDocument();
});
+
+test('should render tooltip if description is not empty', async () => {
+ render(setup(mockedProps()));
+ const toolTips = await screen.findAllByTestId('filter-description');
+ expect(toolTips).toHaveLength(4);
+ toolTips.map(item => expect(item).toBeInTheDocument());
+});
+test('should not render tooltip if description is empty', () => {
Review comment:
```suggestion
});
test('should not render tooltip if description is empty', () => {
```
##########
File path:
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
##########
@@ -44,53 +45,52 @@ import React, {
useState,
} from 'react';
import { useSelector } from 'react-redux';
-import { isEqual, isEmpty } from 'lodash';
-import { FormItem } from 'src/components/Form';
-import { Input } from 'src/common/components';
+import { getChartDataRequest } from 'src/chart/chartAction';
+import { Input, TextArea } from 'src/common/components';
import { Select } from 'src/components';
-import { cacheWrapper } from 'src/utils/cacheWrapper';
-import AdhocFilterControl from
'src/explore/components/controls/FilterControl/AdhocFilterControl';
-import DateFilterControl from
'src/explore/components/controls/DateFilterControl';
-import { addDangerToast } from 'src/components/MessageToasts/actions';
-import { ClientErrorObject } from 'src/utils/getClientErrorObject';
import Collapse from 'src/components/Collapse';
-import { getChartDataRequest } from 'src/chart/chartAction';
-import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
-import { waitForAsyncData } from 'src/middleware/asyncEvent';
-import Tabs from 'src/components/Tabs';
+import BasicErrorAlert from 'src/components/ErrorMessage/BasicErrorAlert';
+import { FormItem } from 'src/components/Form';
import Icons from 'src/components/Icons';
-import { Tooltip } from 'src/components/Tooltip';
+import Loading from 'src/components/Loading';
+import { addDangerToast } from 'src/components/MessageToasts/actions';
import { Radio } from 'src/components/Radio';
-import BasicErrorAlert from 'src/components/ErrorMessage/BasicErrorAlert';
+import Tabs from 'src/components/Tabs';
+import { Tooltip } from 'src/components/Tooltip';
import {
Chart,
ChartsState,
DatasourcesState,
RootState,
} from 'src/dashboard/types';
-import Loading from 'src/components/Loading';
+import DateFilterControl from
'src/explore/components/controls/DateFilterControl';
+import AdhocFilterControl from
'src/explore/components/controls/FilterControl/AdhocFilterControl';
+import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags';
+import { waitForAsyncData } from 'src/middleware/asyncEvent';
+import { cacheWrapper } from 'src/utils/cacheWrapper';
+import { ClientErrorObject } from 'src/utils/getClientErrorObject';
+import { Filter, NativeFilterType } from '../../types';
+import { getFormData } from '../../utils';
Review comment:
```suggestion
import {
Filter,
NativeFilterType,
} from 'src/dashboard/components/nativeFilters/types';
import { getFormData } from 'src/dashboard/components/nativeFilters/utils';
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]