mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'query-editor-breakout'
Conflicts: CHANGELOG.md
This commit is contained in:
@@ -13,9 +13,7 @@ define([
|
||||
beforeEach(ctx.createControllerPhase('GraphiteQueryCtrl'));
|
||||
|
||||
beforeEach(function() {
|
||||
ctx.scope.target = {
|
||||
target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)'
|
||||
};
|
||||
ctx.scope.target = {target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)'};
|
||||
|
||||
ctx.scope.datasource = ctx.datasource;
|
||||
ctx.scope.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([]));
|
||||
|
||||
58
public/test/specs/panelSrv-specs.js
Normal file
58
public/test/specs/panelSrv-specs.js
Normal file
@@ -0,0 +1,58 @@
|
||||
define([
|
||||
'helpers',
|
||||
'features/panel/panelSrv',
|
||||
], function() {
|
||||
'use strict';
|
||||
|
||||
describe('PanelSrv', function() {
|
||||
var _panelSrv;
|
||||
var _panelScope;
|
||||
var _datasourceSrvStub;
|
||||
|
||||
beforeEach(module('grafana.services'));
|
||||
beforeEach(module(function($provide) {
|
||||
_datasourceSrvStub = {
|
||||
getMetricSources: sinon.spy(),
|
||||
};
|
||||
$provide.value('datasourceSrv', _datasourceSrvStub);
|
||||
}));
|
||||
|
||||
beforeEach(inject(function(panelSrv, $rootScope) {
|
||||
_panelSrv = panelSrv;
|
||||
_panelScope = $rootScope.$new();
|
||||
_panelScope.panel = {
|
||||
targets: [],
|
||||
};
|
||||
_panelScope.dashboardViewState = {
|
||||
registerPanel: sinon.spy(),
|
||||
};
|
||||
}));
|
||||
|
||||
describe('init', function() {
|
||||
beforeEach(function() {
|
||||
_panelSrv.init(_panelScope);
|
||||
});
|
||||
|
||||
describe('addDataQuery', function() {
|
||||
it('should add target', function() {
|
||||
_panelScope.addDataQuery();
|
||||
expect(_panelScope.panel.targets.length).to.be(1);
|
||||
});
|
||||
|
||||
it('should set refId', function() {
|
||||
_panelScope.addDataQuery();
|
||||
expect(_panelScope.panel.targets[0].refId).to.be('A');
|
||||
});
|
||||
|
||||
it('should set refId to first available letter', function() {
|
||||
_panelScope.panel.targets = [{refId: 'A'}];
|
||||
_panelScope.addDataQuery();
|
||||
expect(_panelScope.panel.targets[1].refId).to.be('B');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -139,6 +139,7 @@ require([
|
||||
'specs/seriesOverridesCtrl-specs',
|
||||
'specs/shareModalCtrl-specs',
|
||||
'specs/timeSrv-specs',
|
||||
'specs/panelSrv-specs',
|
||||
'specs/templateSrv-specs',
|
||||
'specs/templateValuesSrv-specs',
|
||||
'specs/kbn-format-specs',
|
||||
|
||||
Reference in New Issue
Block a user