triggers panel: tests for schema migration
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
/* globals global: false */
|
||||
|
||||
import {JSDOM} from 'jsdom';
|
||||
import System from 'systemjs';
|
||||
import {PanelCtrl} from './panelStub';
|
||||
|
||||
// Mock Grafana modules that are not available outside of the core project
|
||||
// Required for loading module.js
|
||||
@@ -17,9 +19,12 @@ jest.mock('angular', () => {
|
||||
};
|
||||
}, {virtual: true});
|
||||
|
||||
let mockPanelCtrl = PanelCtrl;
|
||||
jest.mock('app/plugins/sdk', () => {
|
||||
return {
|
||||
QueryCtrl: null
|
||||
QueryCtrl: null,
|
||||
loadPluginCss: () => {},
|
||||
PanelCtrl: mockPanelCtrl
|
||||
};
|
||||
}, {virtual: true});
|
||||
|
||||
@@ -48,3 +53,4 @@ let dom = new JSDOM('<html><head><script></script></head><body></body></html>');
|
||||
global.window = dom.window;
|
||||
global.document = global.window.document;
|
||||
global.Node = window.Node;
|
||||
global.System = System;
|
||||
|
||||
97
src/test-setup/panelStub.js
Normal file
97
src/test-setup/panelStub.js
Normal file
@@ -0,0 +1,97 @@
|
||||
// JSHint options
|
||||
/* jshint ignore:start */
|
||||
|
||||
export class PanelCtrl {
|
||||
constructor($scope, $injector) {
|
||||
this.$injector = $injector;
|
||||
this.$scope = $scope;
|
||||
this.panel = $scope.panel;
|
||||
this.events = {
|
||||
on: () => {}
|
||||
};
|
||||
}
|
||||
|
||||
init() {
|
||||
}
|
||||
|
||||
renderingCompleted() {
|
||||
}
|
||||
|
||||
refresh() {
|
||||
}
|
||||
|
||||
publishAppEvent(evtName, evt) {
|
||||
}
|
||||
|
||||
changeView(fullscreen, edit) {
|
||||
}
|
||||
|
||||
viewPanel() {
|
||||
this.changeView(true, false);
|
||||
}
|
||||
|
||||
editPanel() {
|
||||
this.changeView(true, true);
|
||||
}
|
||||
|
||||
exitFullscreen() {
|
||||
this.changeView(false, false);
|
||||
}
|
||||
|
||||
initEditMode() {
|
||||
}
|
||||
|
||||
changeTab(newIndex) {
|
||||
}
|
||||
|
||||
addEditorTab(title, directiveFn, index) {
|
||||
}
|
||||
|
||||
getMenu() {
|
||||
return [];
|
||||
}
|
||||
|
||||
getExtendedMenu() {
|
||||
return [];
|
||||
}
|
||||
|
||||
otherPanelInFullscreenMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
calculatePanelHeight() {
|
||||
}
|
||||
|
||||
render(payload) {
|
||||
}
|
||||
|
||||
toggleEditorHelp(index) {
|
||||
}
|
||||
|
||||
duplicate() {
|
||||
}
|
||||
|
||||
updateColumnSpan(span) {
|
||||
}
|
||||
|
||||
removePanel() {
|
||||
}
|
||||
|
||||
editPanelJson() {
|
||||
}
|
||||
|
||||
replacePanel(newPanel, oldPanel) {
|
||||
}
|
||||
|
||||
sharePanel() {
|
||||
}
|
||||
|
||||
getInfoMode() {
|
||||
}
|
||||
|
||||
getInfoContent(options) {
|
||||
}
|
||||
|
||||
openInspector() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user