Files
grafana/public/app/features/dashboard-scene/utils/PanelModelCompatibilityWrapper.test.ts
Ivan Ortega Alba abac53bd0a Revert "Revert "LibraryPanel: Fallback to panel title if library panel title is not set"" (#99678)
Revert "Revert "LibraryPanel: Fallback to panel title if library panel title …"

This reverts commit 6e705ee67c.
2025-01-28 09:53:19 -07:00

30 lines
926 B
TypeScript

import { VizPanel } from '@grafana/scenes';
import { LibraryPanelBehavior } from '../scene/LibraryPanelBehavior';
import { PanelModelCompatibilityWrapper } from './PanelModelCompatibilityWrapper';
describe('PanelModelCompatibilityWrapper', () => {
it('Can get legacy id', () => {
const vizPanel = new VizPanel({ pluginId: 'test', title: 'test', description: 'test', key: 'panel-24' });
const panelModel = new PanelModelCompatibilityWrapper(vizPanel);
expect(panelModel.id).toBe(24);
});
it('Can get legacy id for lib panel', () => {
const panel = new VizPanel({ pluginId: 'test', title: 'test', description: 'test', key: 'panel-24' });
const libPanel = new LibraryPanelBehavior({
uid: 'a',
name: 'aa',
});
panel.setState({
$behaviors: [libPanel],
});
const panelModel = new PanelModelCompatibilityWrapper(panel);
expect(panelModel.id).toBe(24);
});
});