mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 08:22:20 +08:00
TextPanel: Fixes problems where text panel would show old content (#28643)
This commit is contained in:
@ -8,12 +8,30 @@ describe('textPanelMigrationHandler', () => {
|
||||
const panel: any = {
|
||||
content: '<span>Hello World<span>',
|
||||
mode: 'html',
|
||||
options: {},
|
||||
};
|
||||
|
||||
const result = textPanelMigrationHandler(panel);
|
||||
|
||||
expect(result.content).toEqual('<span>Hello World<span>');
|
||||
expect(result.mode).toEqual('html');
|
||||
expect(panel.content).toBeUndefined();
|
||||
expect(panel.mode).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when invoked and previous version 7.1 or later', () => {
|
||||
it('then not migrate options', () => {
|
||||
const panel: any = {
|
||||
content: '<span>Hello World<span>',
|
||||
mode: 'html',
|
||||
options: { content: 'New content' },
|
||||
pluginVersion: '7.1.0',
|
||||
};
|
||||
|
||||
const result = textPanelMigrationHandler(panel);
|
||||
|
||||
expect(result.content).toEqual('New content');
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user