|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
import { PanelModel, FieldConfigSource } from '@grafana/data'; |
|
|
|
|
import { graphPanelChangedHandler } from './migrations'; |
|
|
|
|
import { cloneDeep } from 'lodash'; |
|
|
|
|
|
|
|
|
|
describe('Graph Migrations', () => { |
|
|
|
|
let prevFieldConfig: FieldConfigSource; |
|
|
|
@ -67,6 +68,15 @@ describe('Graph Migrations', () => { |
|
|
|
|
expect(panel).toMatchSnapshot(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('preserves series overrides using a regex alias', () => { |
|
|
|
|
const old: any = { |
|
|
|
|
angular: customColorRegex, |
|
|
|
|
}; |
|
|
|
|
const panel = {} as PanelModel; |
|
|
|
|
panel.options = graphPanelChangedHandler(panel, 'graph', old, prevFieldConfig); |
|
|
|
|
expect(panel).toMatchSnapshot(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('legend', () => { |
|
|
|
|
test('without values', () => { |
|
|
|
|
const old: any = { |
|
|
|
@ -383,6 +393,9 @@ const customColor = { |
|
|
|
|
datasource: null, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const customColorRegex = cloneDeep(customColor); |
|
|
|
|
customColorRegex.seriesOverrides[0].alias = '/^A-/'; |
|
|
|
|
|
|
|
|
|
const stairscase = { |
|
|
|
|
aliasColors: {}, |
|
|
|
|
dashLength: 10, |
|
|
|
|