UNPKG

@fusioncharts/fusiontime

Version:

FusionCharts JavaScript time-series charting framework

1 lines 5.62 kB
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _core=_interopRequireDefault(require("../../../../fusioncharts/core"));var _redraphael=_interopRequireDefault(require("../../../../fc-core/src/_internal/redraphael/redraphael"));var _discrete=_interopRequireDefault(require("../../../../fc-charts/src/_internal/components/legend/discrete"));_core.default.addDep(_redraphael.default);describe("FTLD_TS_4: To verify cosmetics of legend background.",(function(){var legend,objStore={},animationManager={setAnimation:function setAnimation(obj){objStore[obj.label]=obj;return{shadow:function shadow(param){return param}}}},style={outCancolor:"#000000",fontSize:"10",outCanfontFamily:"sans-serif"},chart={config:{},getFromEnv:function getFromEnv(){return{}},getName:function getName(){return"chart"}},colorM={getColor:function getColor(color){return color}};beforeEach((function(){legend=new _discrete.default;legend.addToEnv("animationManager",animationManager);legend.addToEnv("chart",chart);legend.addToEnv("style",style);legend.addToEnv("color-manager",colorM);legend.configure({drawcustomlegendicon:1,legendiconsides:4,alignlegendwithcanvas:1,legendborderthickness:0,legendbgalpha:0})}));afterEach((function(){legend=undefined}));it("FTLD_TC_9: To verify that legend backgroud and border is not drawn.",(function(){legend.drawLegendBox();for(var prop in objStore){expect(objStore[prop].attr["stroke-width"]).toBe(0)}}));it("FTLD_TC_10: To verify that legend border is not drawn.",(function(){legend.drawLegendBox();for(var prop in objStore){expect(objStore[prop].attr["fill-opacity"]).toBe(0)}}))}));describe("FTLD_TS_3: To verify cosmetics of legend items.",(function(){var legend,objStore={},graphicalElement={},animationManager={setAnimation:function setAnimation(obj){objStore[obj.el]=obj;return{shadow:function shadow(param){return param}}}},style={outCancolor:"#000000",fontSize:"10",outCanfontFamily:"sans-serif"},chart={config:{},getFromEnv:function getFromEnv(){return{}},getName:function getName(){return"chart"}},dataset={config:{series:"Timeseries"},getName:function getName(){return"dataset"}},colorM={getColor:function getColor(color){return color}};beforeEach((function(){legend=new _discrete.default;legend.addToEnv("animationManager",animationManager);legend.addToEnv("chart",chart);legend.addToEnv("dataset",dataset);legend.addToEnv("style",style);legend.addToEnv("color-manager",colorM);legend.configure({drawcustomlegendicon:1,legendiconsides:4,alignlegendwithcanvas:1,legendborderthickness:0,legendbgalpha:0})}));afterEach((function(){legend=undefined}));it("FTLD_TC_5: To verify that properties of legendItemText is applied as per styles provided",(function(){legend.setStateCosmetics("default",{text:{fill:"#000000","font-family":"sans-serif","font-size":"12px",direction:"initial"},symbol:{bgColor:"#00ff00",startAngle:45,sides:4}});var id=legend.createItem(dataset),item=legend.getItem(id),prop;item.addGraphicalElement=function(name,obj){obj.data=function(key,config){obj._data={};obj._data[key]=config;return obj};return obj};item.getGraphicalElement=function(label){return graphicalElement[label]};item.draw();for(prop in objStore){if(prop==="text"){expect(objStore[prop].attr.fill).toBe("#000000");expect(objStore[prop].attr["font-family"]).toBe("sans-serif");expect(objStore[prop].attr["font-size"]).toBe("12px")}}}));it("FTLD_TC_6: To verify that properties of legendItemText is applied to default when property is not given or invalid",(function(){var id=legend.createItem(dataset),item=legend.getItem(id),prop;item.addGraphicalElement=function(name,obj){obj.data=function(key,config){obj._data={};obj._data[key]=config;return obj};return obj};item.getGraphicalElement=function(label){return graphicalElement[label]};item.draw();for(prop in objStore){if(prop==="text"){expect(objStore[prop].attr.fill).toBe("rgba(0,0,0,1)");expect(objStore[prop].attr["font-family"]).toBe("sans-serif");expect(objStore[prop].attr["font-size"]).toBe("10px")}}}));it("FTLD_TC_7: To verify that properties of legendItemSymbol is applied as per styles provided",(function(){legend.setStateCosmetics("default",{text:{fill:"#000000","font-family":"sans-serif","font-size":"12px",direction:"initial"},symbol:{bgColor:"#00ff00",startAngle:45,sides:4}});var id=legend.createItem(dataset),item=legend.getItem(id),prop;item.addGraphicalElement=function(name,obj){obj.data=function(key,config){obj._data={};obj._data[key]=config;return obj};return obj};item.getGraphicalElement=function(label){return graphicalElement[label]};item.draw();for(prop in objStore){if(prop==="path"){expect(objStore[prop].attr.path.join()).toBe("M,4.242640687119286,-4.242640687119285,L,-4.242640687119285,-4.242640687119286,L,-4.242640687119286,4.242640687119285,L,4.242640687119284,4.242640687119286,Z");expect(objStore[prop].attr.fill).toBe("rgba(0,255,0,1)")}}}));it("FTLD_TC_8: To verify that properties of legendItemSymbol is applied to default when property is not given or invalid",(function(){var id=legend.createItem(dataset),item=legend.getItem(id),prop;item.addGraphicalElement=function(name,obj){obj.data=function(key,config){obj._data={};obj._data[key]=config;return obj};return obj};item.getGraphicalElement=function(label){return graphicalElement[label]};item.draw();for(prop in objStore){if(prop==="path"){expect(objStore[prop].attr.path.join()).toBe("M,4.242640687119286,-4.242640687119285,L,-4.242640687119285,-4.242640687119286,L,-4.242640687119286,4.242640687119285,L,4.242640687119284,4.242640687119286,Z");expect(objStore[prop].attr.fill).toBe("rgba(0,0,0,1)")}}}))}));