mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(panels): fixed singlestat tests
This commit is contained in:
@@ -230,8 +230,6 @@ function getColorForValue(data, value) {
|
||||
return data.colorMap[i];
|
||||
}
|
||||
}
|
||||
|
||||
console.log('first');
|
||||
return _.first(data.colorMap);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,6 @@ import angular from 'angular';
|
||||
import helpers from '../../../../../test/specs/helpers';
|
||||
import {SingleStatCtrl} from '../controller';
|
||||
|
||||
|
||||
angular.module('grafana.controllers').controller('SingleStatCtrl', SingleStatCtrl);
|
||||
|
||||
describe('SingleStatCtrl', function() {
|
||||
var ctx = new helpers.ControllerTestContext();
|
||||
|
||||
@@ -25,7 +22,7 @@ describe('SingleStatCtrl', function() {
|
||||
beforeEach(angularMocks.module('grafana.controllers'));
|
||||
|
||||
beforeEach(ctx.providePhase());
|
||||
beforeEach(ctx.createControllerPhase('SingleStatCtrl'));
|
||||
beforeEach(ctx.createPanelController(SingleStatCtrl));
|
||||
|
||||
beforeEach(function() {
|
||||
setupFunc();
|
||||
@@ -33,9 +30,9 @@ describe('SingleStatCtrl', function() {
|
||||
data: [{target: 'test.cpu1', datapoints: ctx.datapoints}]
|
||||
}));
|
||||
|
||||
ctx.scope.refreshData(ctx.datasource);
|
||||
ctx.ctrl.refreshData(ctx.datasource);
|
||||
ctx.scope.$digest();
|
||||
ctx.data = ctx.scope.data;
|
||||
ctx.data = ctx.ctrl.data;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -76,7 +73,7 @@ describe('SingleStatCtrl', function() {
|
||||
singleStatScenario('When value to text mapping is specified', function(ctx) {
|
||||
ctx.setup(function() {
|
||||
ctx.datapoints = [[10,1]];
|
||||
ctx.scope.panel.valueMaps = [{value: '10', text: 'OK'}];
|
||||
ctx.ctrl.panel.valueMaps = [{value: '10', text: 'OK'}];
|
||||
});
|
||||
|
||||
it('Should replace value with text', function() {
|
||||
|
||||
Reference in New Issue
Block a user