/*! grafana - v4.2.0 - 2017-03-24
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["../../../../../test/lib/common","../threshold_manager"],function(a,b){"use strict";var c,d;b&&b.id;return{setters:[function(a){c=a},function(a){d=a}],execute:function(){c.describe("ThresholdManager",function(){function a(a,b){c.describe(a,function(){var a={panel:{thresholds:[]},options:{grid:{markings:[]}},panelCtrl:{}};a.setup=function(b){a.panel.thresholds=b;var c=new d.ThresholdManager(a.panelCtrl);c.addPlotOptions(a.options,a.panel)},b(a)})}c.describe("When creating plot markings",function(){a("for simple gt threshold",function(a){a.setup([{op:"gt",value:300,fill:!0,line:!0,colorMode:"critical"}]),c.it("should add fill for threshold with fill: true",function(){var b=a.options.grid.markings;c.expect(b[0].yaxis.from).to.be(300),c.expect(b[0].yaxis.to).to.be(1/0),c.expect(b[0].color).to.be("rgba(234, 112, 112, 0.12)")}),c.it("should add line",function(){var b=a.options.grid.markings;c.expect(b[1].yaxis.from).to.be(300),c.expect(b[1].yaxis.to).to.be(300),c.expect(b[1].color).to.be("rgba(237, 46, 24, 0.60)")})}),a("for two gt thresholds",function(a){a.setup([{op:"gt",value:200,fill:!0,colorMode:"warning"},{op:"gt",value:300,fill:!0,colorMode:"critical"}]),c.it("should add fill for first thresholds to next threshold",function(){var b=a.options.grid.markings;c.expect(b[0].yaxis.from).to.be(200),c.expect(b[0].yaxis.to).to.be(300)}),c.it("should add fill for last thresholds to infinity",function(){var b=a.options.grid.markings;c.expect(b[1].yaxis.from).to.be(300),c.expect(b[1].yaxis.to).to.be(1/0)})}),a("for lt then gt threshold (inside)",function(a){a.setup([{op:"lt",value:300,fill:!0,colorMode:"critical"},{op:"gt",value:200,fill:!0,colorMode:"critical"}]),c.it("should add fill for first thresholds to next threshold",function(){var b=a.options.grid.markings;c.expect(b[0].yaxis.from).to.be(300),c.expect(b[0].yaxis.to).to.be(200)}),c.it("should add fill for last thresholds to itself",function(){var b=a.options.grid.markings;c.expect(b[1].yaxis.from).to.be(200),c.expect(b[1].yaxis.to).to.be(200)})}),a("for gt then lt threshold (outside)",function(a){a.setup([{op:"gt",value:300,fill:!0,colorMode:"critical"},{op:"lt",value:200,fill:!0,colorMode:"critical"}]),c.it("should add fill for first thresholds to next threshold",function(){var b=a.options.grid.markings;c.expect(b[0].yaxis.from).to.be(300),c.expect(b[0].yaxis.to).to.be(1/0)}),c.it("should add fill for last thresholds to itself",function(){var b=a.options.grid.markings;c.expect(b[1].yaxis.from).to.be(200),c.expect(b[1].yaxis.to).to.be(-(1/0))})})})})}}});