Merge branch 'query-editor-breakout'

Conflicts:
	CHANGELOG.md
This commit is contained in:
Torkel Ödegaard
2015-08-18 08:23:13 +02:00
53 changed files with 1704 additions and 1386 deletions

View File

@@ -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([]));

View 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');
});
});
});
});
});

View File

@@ -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',