|
|
@@ -312,5 +312,52 @@ describe('grafanaGraph', function() {
|
|
|
expect(ctx.plotOptions.yaxes[0].max).to.be(0);
|
|
|
});
|
|
|
});
|
|
|
+ describe('and negative values used', function() {
|
|
|
+ ctx.setup(function(ctrl, data) {
|
|
|
+ ctrl.panel.yaxes[0].min = '-10';
|
|
|
+ ctrl.panel.yaxes[0].max = '-13.14';
|
|
|
+ data[0] = new TimeSeries({
|
|
|
+ datapoints: [[120,10],[160,20]],
|
|
|
+ alias: 'series1',
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should set min and max to negative', function() {
|
|
|
+ expect(ctx.plotOptions.yaxes[0].min).to.be(-10);
|
|
|
+ expect(ctx.plotOptions.yaxes[0].max).to.be(-13.14);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ graphScenario('when using Y-Min and Y-Max settings stored as number', function(ctx) {
|
|
|
+ describe('and Y-Min is 0 and Y-Max is 100', function() {
|
|
|
+ ctx.setup(function(ctrl, data) {
|
|
|
+ ctrl.panel.yaxes[0].min = 0;
|
|
|
+ ctrl.panel.yaxes[0].max = 100;
|
|
|
+ data[0] = new TimeSeries({
|
|
|
+ datapoints: [[120,10],[160,20]],
|
|
|
+ alias: 'series1',
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should set min to 0 and max to 100', function() {
|
|
|
+ expect(ctx.plotOptions.yaxes[0].min).to.be(0);
|
|
|
+ expect(ctx.plotOptions.yaxes[0].max).to.be(100);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ describe('and Y-Min is -100 and Y-Max is -10.5', function() {
|
|
|
+ ctx.setup(function(ctrl, data) {
|
|
|
+ ctrl.panel.yaxes[0].min = -100;
|
|
|
+ ctrl.panel.yaxes[0].max = -10.5;
|
|
|
+ data[0] = new TimeSeries({
|
|
|
+ datapoints: [[120,10],[160,20]],
|
|
|
+ alias: 'series1',
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should set min to -100 and max to -10.5', function() {
|
|
|
+ expect(ctx.plotOptions.yaxes[0].min).to.be(-100);
|
|
|
+ expect(ctx.plotOptions.yaxes[0].max).to.be(-10.5);
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
});
|