diff --git a/src/plugins/visualize/public/application/components/visualize_editor_common.test.tsx b/src/plugins/visualize/public/application/components/visualize_editor_common.test.tsx index dbe658b8b2d3c..d0c7b56638bc2 100644 --- a/src/plugins/visualize/public/application/components/visualize_editor_common.test.tsx +++ b/src/plugins/visualize/public/application/components/visualize_editor_common.test.tsx @@ -10,6 +10,7 @@ import React from 'react'; import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; import { VisualizeEditorCommon } from './visualize_editor_common'; import { VisualizeEditorVisInstance } from '../types'; +import { SplitChartWarning } from './split_chart_warning'; const mockGetLegacyUrlConflict = jest.fn(); const mockRedirectLegacyUrl = jest.fn(() => Promise.resolve()); @@ -115,4 +116,86 @@ describe('VisualizeEditorCommon', () => { 'TSVB visualization' ); }); + + it('should display a warning callout for new heatmap implementation with split aggs', async () => { + const wrapper = shallowWithIntl( + {}} + hasUnappliedChanges={false} + isEmbeddableRendered={false} + onAppLeave={() => {}} + visEditorRef={React.createRef()} + visInstance={ + { + savedVis: { + id: 'test', + sharingSavedObjectProps: { + outcome: 'conflict', + aliasTargetId: 'alias_id', + }, + }, + vis: { + type: { + title: 'Heatmap', + name: 'heatmap', + }, + data: { + aggs: { + aggs: [ + { + schema: 'split', + }, + ], + }, + }, + }, + } as unknown as VisualizeEditorVisInstance + } + /> + ); + expect(wrapper.find(SplitChartWarning).length).toBe(1); + }); + + it('should not display a warning callout for XY charts with split aggs', async () => { + const wrapper = shallowWithIntl( + {}} + hasUnappliedChanges={false} + isEmbeddableRendered={false} + onAppLeave={() => {}} + visEditorRef={React.createRef()} + visInstance={ + { + savedVis: { + id: 'test', + sharingSavedObjectProps: { + outcome: 'conflict', + aliasTargetId: 'alias_id', + }, + }, + vis: { + type: { + title: 'XY', + name: 'line', + }, + data: { + aggs: { + aggs: [ + { + schema: 'split', + }, + ], + }, + }, + }, + } as unknown as VisualizeEditorVisInstance + } + /> + ); + expect(wrapper.find(SplitChartWarning).length).toBe(0); + }); }); diff --git a/src/plugins/visualize/public/application/components/visualize_editor_common.tsx b/src/plugins/visualize/public/application/components/visualize_editor_common.tsx index b764c9de48346..706fe55d0754e 100644 --- a/src/plugins/visualize/public/application/components/visualize_editor_common.tsx +++ b/src/plugins/visualize/public/application/components/visualize_editor_common.tsx @@ -134,7 +134,9 @@ export const VisualizeEditorCommon = ({ /> )} {visInstance?.vis?.type?.stage === 'experimental' && } - {!hasHeatmapLegacyhartsEnabled && isSplitChart && } + {!hasHeatmapLegacyhartsEnabled && + isSplitChart && + visInstance?.vis.type.name === 'heatmap' && } {visInstance?.vis?.type?.getInfoMessage?.(visInstance.vis)} {getLegacyUrlConflictCallout()} {visInstance && (