mirror of
https://github.com/apache/superset.git
synced 2026-06-01 13:49:21 +00:00
feat(explore): UI changes in dataset panel on Explore page (#19394)
* feat(explore): Implement new design for dataset panel * Fixes * Replace drag handle in dashboard builder * Add missing types * Type fix * Fix tests * Fix non-dnd version * Fix test * Replace margin with height
This commit is contained in:
committed by
GitHub
parent
a619cb4ea9
commit
a076ae6d99
@@ -18,14 +18,12 @@
|
||||
*/
|
||||
/* eslint-disable no-unused-expressions */
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { styledMount as mount } from 'spec/helpers/theming';
|
||||
import { render, screen } from 'spec/helpers/testing-library';
|
||||
import FilterDefinitionOption from 'src/explore/components/controls/MetricControl/FilterDefinitionOption';
|
||||
import { AGGREGATES } from 'src/explore/constants';
|
||||
import AdhocMetric, {
|
||||
EXPRESSION_TYPES,
|
||||
} from 'src/explore/components/controls/MetricControl/AdhocMetric';
|
||||
import { StyledColumnOption } from 'src/explore/components/optionRenderers';
|
||||
|
||||
const sumValueAdhocMetric = new AdhocMetric({
|
||||
expressionType: EXPRESSION_TYPES.SIMPLE,
|
||||
@@ -35,25 +33,21 @@ const sumValueAdhocMetric = new AdhocMetric({
|
||||
|
||||
describe('FilterDefinitionOption', () => {
|
||||
it('renders a StyledColumnOption given a column', () => {
|
||||
const wrapper = shallow(
|
||||
<FilterDefinitionOption option={{ column_name: 'a_column' }} />,
|
||||
);
|
||||
expect(wrapper.find(StyledColumnOption)).toExist();
|
||||
render(<FilterDefinitionOption option={{ column_name: 'a_column' }} />);
|
||||
expect(screen.getByText('a_column')).toBeVisible();
|
||||
});
|
||||
|
||||
it('renders a StyledColumnOption given an adhoc metric', () => {
|
||||
const wrapper = shallow(
|
||||
<FilterDefinitionOption option={sumValueAdhocMetric} />,
|
||||
);
|
||||
expect(wrapper.find(StyledColumnOption)).toExist();
|
||||
render(<FilterDefinitionOption option={sumValueAdhocMetric} />);
|
||||
expect(screen.getByText('SUM(source)')).toBeVisible();
|
||||
});
|
||||
|
||||
it('renders the metric name given a saved metric', () => {
|
||||
const wrapper = mount(
|
||||
render(
|
||||
<FilterDefinitionOption
|
||||
option={{ saved_metric_name: 'my_custom_metric' }}
|
||||
/>,
|
||||
);
|
||||
expect(wrapper.find('.option-label').text()).toBe('my_custom_metric');
|
||||
expect(screen.getByText('my_custom_metric')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user