diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/components/MetricOption.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/components/MetricOption.tsx index 8d03cf884b26c..38b8cb6fc1632 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/components/MetricOption.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/components/MetricOption.tsx @@ -22,7 +22,7 @@ import InfoTooltipWithTrigger from './InfoTooltipWithTrigger'; import { ColumnTypeLabel } from './ColumnTypeLabel'; import CertifiedIconWithTooltip from './CertifiedIconWithTooltip'; import Tooltip from './Tooltip'; -import { getMeticTooltipNode } from './labelUtils'; +import { getMetricTooltipNode } from './labelUtils'; const FlexRowContainer = styled.div` align-items: center; @@ -64,7 +64,7 @@ export function MetricOption({ const [tooltipText, setTooltipText] = useState(metric.metric_name); useEffect(() => { - setTooltipText(getMeticTooltipNode(metric, labelRef)); + setTooltipText(getMetricTooltipNode(metric, labelRef)); }, [labelRef, metric]); return ( diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/components/labelUtils.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/components/labelUtils.tsx index eae09652546ea..ee738e1195683 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/components/labelUtils.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/components/labelUtils.tsx @@ -55,7 +55,7 @@ export const getColumnTooltipNode = ( type MetricType = Omit & { label?: string }; -export const getMeticTooltipNode = ( +export const getMetricTooltipNode = ( metric: MetricType, labelRef?: React.RefObject, ): ReactNode => { diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/components/labelUtils.test.tsx b/superset-frontend/packages/superset-ui-chart-controls/test/components/labelUtils.test.tsx index 8f31fd3d67c88..b5e5cd6adfa21 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/test/components/labelUtils.test.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/test/components/labelUtils.test.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { getColumnLabelText, getColumnTooltipNode, - getMeticTooltipNode, + getMetricTooltipNode, } from '../../src/components/labelUtils'; test("should get column name when column doesn't have verbose_name", () => { @@ -58,7 +58,7 @@ test('should get null as tooltip', () => { ).toBe(null); }); -test('should get column name as tooltip when it verbose name', () => { +test('should get column name and verbose name when it has a verbose name', () => { const rvNode = ( <>
column name: column name
@@ -93,7 +93,7 @@ test('should get column name as tooltip if it overflowed', () => { ).toBe('column name: long long long long column name'); }); -test('should get verbose name as tooltip if it overflowed', () => { +test('should get column name and verbose name as tooltip if it overflowed', () => { const rvNode = ( <>
column name: long long long long column name
@@ -117,7 +117,7 @@ test('should get verbose name as tooltip if it overflowed', () => { test('should get null as tooltip in metric', () => { const ref = { current: { scrollWidth: 100, clientWidth: 100 } }; expect( - getMeticTooltipNode( + getMetricTooltipNode( { metric_name: 'count', label: '', @@ -128,7 +128,7 @@ test('should get null as tooltip in metric', () => { ).toBe(null); }); -test('should get metric name(sql alias) as tooltip in metric', () => { +test('should get metric name and verbose name as tooltip in metric', () => { const rvNode = ( <>
metric name: count
@@ -138,7 +138,7 @@ test('should get metric name(sql alias) as tooltip in metric', () => { const ref = { current: { scrollWidth: 100, clientWidth: 100 } }; expect( - getMeticTooltipNode( + getMetricTooltipNode( { metric_name: 'count', label: 'count(*)', @@ -149,7 +149,7 @@ test('should get metric name(sql alias) as tooltip in metric', () => { ).toStrictEqual(rvNode); }); -test('should get verbose name as tooltip in metric if it overflowed', () => { +test('should get metric name and verbose name in tooltip if it overflowed', () => { const rvNode = ( <>
metric name: count
@@ -159,7 +159,7 @@ test('should get verbose name as tooltip in metric if it overflowed', () => { const ref = { current: { scrollWidth: 200, clientWidth: 100 } }; expect( - getMeticTooltipNode( + getMetricTooltipNode( { metric_name: 'count', label: '', @@ -173,7 +173,7 @@ test('should get verbose name as tooltip in metric if it overflowed', () => { test('should get label name as tooltip in metric if it overflowed', () => { const ref = { current: { scrollWidth: 200, clientWidth: 100 } }; expect( - getMeticTooltipNode( + getMetricTooltipNode( { metric_name: 'count', label: 'longlonglonglonglong metric label',