mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
Moves query execution logic to PanelQueryRunner and structures PanelChrome so it subscribes to the query results rather than necessarily controlling their execution.
29 lines
751 B
TypeScript
29 lines
751 B
TypeScript
import { PanelChrome } from './PanelChrome';
|
|
|
|
describe('PanelChrome', () => {
|
|
let chrome: PanelChrome;
|
|
|
|
beforeEach(() => {
|
|
chrome = new PanelChrome({
|
|
panel: {
|
|
scopedVars: {
|
|
aaa: { value: 'AAA', text: 'upperA' },
|
|
bbb: { value: 'BBB', text: 'upperB' },
|
|
},
|
|
},
|
|
isFullscreen: false,
|
|
} as any);
|
|
});
|
|
|
|
it('Should replace a panel variable', () => {
|
|
const out = chrome.replaceVariables('hello $aaa');
|
|
expect(out).toBe('hello AAA');
|
|
});
|
|
|
|
it('But it should prefer the local variable value', () => {
|
|
const extra = { aaa: { text: '???', value: 'XXX' } };
|
|
const out = chrome.replaceVariables('hello $aaa and $bbb', extra);
|
|
expect(out).toBe('hello XXX and BBB');
|
|
});
|
|
});
|