Ver Fonte

Fix karma tests that rely on MetricsPanelCtrl

David Kaltschmidt há 7 anos atrás
pai
commit
827fb7e8de

+ 2 - 2
public/app/features/panel/metrics_panel_ctrl.ts

@@ -1,9 +1,9 @@
-import config from 'app/core/config';
 import $ from 'jquery';
 import $ from 'jquery';
 import _ from 'lodash';
 import _ from 'lodash';
+
+import config from 'app/core/config';
 import kbn from 'app/core/utils/kbn';
 import kbn from 'app/core/utils/kbn';
 import { PanelCtrl } from 'app/features/panel/panel_ctrl';
 import { PanelCtrl } from 'app/features/panel/panel_ctrl';
-
 import * as rangeUtil from 'app/core/utils/rangeutil';
 import * as rangeUtil from 'app/core/utils/rangeutil';
 import * as dateMath from 'app/core/utils/datemath';
 import * as dateMath from 'app/core/utils/datemath';
 import { encodePathComponent } from 'app/core/utils/location_util';
 import { encodePathComponent } from 'app/core/utils/location_util';

+ 2 - 0
public/test/specs/helpers.ts

@@ -11,6 +11,7 @@ export function ControllerTestContext() {
   this.$element = {};
   this.$element = {};
   this.$sanitize = {};
   this.$sanitize = {};
   this.annotationsSrv = {};
   this.annotationsSrv = {};
+  this.contextSrv = {};
   this.timeSrv = new TimeSrvStub();
   this.timeSrv = new TimeSrvStub();
   this.templateSrv = new TemplateSrvStub();
   this.templateSrv = new TemplateSrvStub();
   this.datasourceSrv = {
   this.datasourceSrv = {
@@ -27,6 +28,7 @@ export function ControllerTestContext() {
 
 
   this.providePhase = function(mocks) {
   this.providePhase = function(mocks) {
     return angularMocks.module(function($provide) {
     return angularMocks.module(function($provide) {
+      $provide.value('contextSrv', self.contextSrv);
       $provide.value('datasourceSrv', self.datasourceSrv);
       $provide.value('datasourceSrv', self.datasourceSrv);
       $provide.value('annotationsSrv', self.annotationsSrv);
       $provide.value('annotationsSrv', self.annotationsSrv);
       $provide.value('timeSrv', self.timeSrv);
       $provide.value('timeSrv', self.timeSrv);