@fusioncharts/fusiontime
Version:
FusionCharts JavaScript time-series charting framework
1 lines • 2.96 kB
JavaScript
;var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _column=_interopRequireDefault(require("./column"));var _lib=require("@fusioncharts/core/src/lib");var firstDate=new Date("Sat Feb 01 2014 21:06:00").getTime(),timeGap=new Date("Sat Feb 02 2014 21:06:00").getTime()-firstDate,timeSpan=3*timeGap,pixelRange=[0,45],curBin=[{name:function name(){return"day"}},1,864e5],xScale={bins:[],getRange:function getRange(){return[0,400]},getDomainValue:function getDomainValue(v){var ratio=Math.abs(pixelRange[0]-v)/(pixelRange[1]-pixelRange[0]);return new Date(firstDate+ratio*timeSpan)},getBinIndex:function getBinIndex(curTimeStamp,startTimeStamp){if(startTimeStamp===void 0){startTimeStamp=firstDate}return Math.floor((curTimeStamp-startTimeStamp)/curBin[2])},_getRangeThreshold:function _getRangeThreshold(){return curBin},showPlotOverTick:function showPlotOverTick(){return false},getBinBounds:function getBinBounds(){return _lib.UNDEF}};describe("To verify _checkPointerOverColumn method",(function(){var cDS=new _column.default;cDS.config.dataInfo=[{x:10,y:100,height:80,width:10},{x:25,y:120,height:100,width:10}];it("CDS-TC-12: To verify if the method returns n'th plot when pointer x, y is inside the plot",(function(){var point=cDS._checkPointerOverColumn(0,12,110);expect(point&&point.pointIndex).toBe(0)}));it("CDS-TC-13: To verify if the method returns n'th plot when pointer x, y is on the edge of the plot",(function(){var point=cDS._checkPointerOverColumn(0,10,110);expect(point&&point.pointIndex).toBe(0)}));it("CDS-TC-14: To verify if the method does not return n'th plot when pointer x, y is out of the plot",(function(){var point=cDS._checkPointerOverColumn(0,9,110);expect(point&&point.hovered).toBe(false)}))}));describe("To verify _getHoveredPlot method",(function(){var cDS=new _column.default;cDS.getLinkedParent=function(){return{getTranslation:function getTranslation(){return{x:0,y:0}}}};cDS.config.firstTimeStamp=new Date(firstDate);cDS.config.timeStampGap=timeGap;cDS.addToEnv("xScale",xScale);cDS.config.dataInfo=[{x:10,y:100,height:80,width:10},{x:25,y:120,height:100,width:10}];it("CDS-TC-15: To verify if the method returns n'th plot when pointer x, y is inside the plot",(function(){var point=cDS._getHoveredPlot(12,110);expect(point&&point.pointIndex).toBe(0)}));it("CDS-TC-16: To verify if the method returns n'th plot when pointer x, y is on the edge of the plot",(function(){var point=cDS._getHoveredPlot(10,110);expect(point&&point.pointIndex).toBe(0)}));it("CDS-TC-17: To verify if the method does not return n'th plot when pointer x, y is out of the plot",(function(){var point=cDS._getHoveredPlot(9,110);expect(point&&point.hovered).toBe(false);point=cDS._getHoveredPlot(21,110);expect(point&&point.hovered).toBe(false);point=cDS._getHoveredPlot(21,109);expect(point&&point.hovered).toBe(false);point=cDS._getHoveredPlot(21,181);expect(point&&point.hovered).toBe(false)}))}));