StatPanels: Fixed migration from old singlestat and default min & max being copied even when gauge was disbled (#21820)

This commit is contained in:
Torkel Ödegaard
2020-01-29 19:42:07 +00:00
committed by GitHub
parent c344a3a66e
commit 13948c0b76
2 changed files with 20 additions and 1 deletions

View File

@@ -103,4 +103,23 @@ describe('Gauge Panel Migrations', () => {
expect(newOptions.showThresholdMarkers).toBe(true);
expect(newOptions.showThresholdLabels).toBe(true);
});
it('change from angular singlestatt with no enabled gauge', () => {
const old: any = {
angular: {
format: 'ms',
decimals: 7,
gauge: {
maxValue: 150,
minValue: -10,
show: false,
},
},
};
const newOptions = gaugePanelChangedHandler({} as any, 'singlestat', old);
expect(newOptions.fieldOptions.defaults.unit).toBe('ms');
expect(newOptions.fieldOptions.defaults.min).toBe(undefined);
expect(newOptions.fieldOptions.defaults.max).toBe(undefined);
});
});