triggers panel: tests for schema migration

This commit is contained in:
Alexander Zobnin
2017-12-03 12:31:56 +03:00
parent b214705052
commit 5359176f2a
17 changed files with 1345 additions and 976 deletions

View File

@@ -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;

View 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() {
}
}