diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2016-03-04 19:10:04 +0100 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-03-04 19:10:04 +0100 |
commit | 15dde408db57009e1e4e26d969b9b3e6c1e0c255 (patch) | |
tree | bed87bc591f44dbdc7967c2c9f8b26dd1b040f49 /web/nms.gathering.org/speedometer/c3-master/spec/tooltip-spec.js | |
parent | 2e808e318a7b9abd09bf93116dae5368025c3611 (diff) |
nms: Remove redundant files
speedometer probably doesn't work now anyway until it's heavily updated.
Diffstat (limited to 'web/nms.gathering.org/speedometer/c3-master/spec/tooltip-spec.js')
-rw-r--r-- | web/nms.gathering.org/speedometer/c3-master/spec/tooltip-spec.js | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/web/nms.gathering.org/speedometer/c3-master/spec/tooltip-spec.js b/web/nms.gathering.org/speedometer/c3-master/spec/tooltip-spec.js deleted file mode 100644 index de3983f..0000000 --- a/web/nms.gathering.org/speedometer/c3-master/spec/tooltip-spec.js +++ /dev/null @@ -1,101 +0,0 @@ -describe('c3 chart tooltip', function () { - 'use strict'; - - var chart; - var tooltipConfiguration; - - var args = function () { - return { - data: { - columns: [ - ['data1', 30, 200, 100, 400, 150, 250], - ['data2', 50, 20, 10, 40, 15, 25], - ['data3', 150, 120, 110, 140, 115, 125] - ], - }, - tooltip: tooltipConfiguration - }; - }; - - beforeEach(function (done) { - chart = window.initChart(chart, args(), done); - }); - - describe('tooltip position', function () { - beforeAll(function () { - tooltipConfiguration = {}; - }); - - describe('without left margin', function () { - - it('should show tooltip on proper position', function () { - var eventRect = d3.select('.c3-event-rect-2').node(); - window.setMouseEvent(chart, 'mousemove', 100, 100, eventRect); - - var tooltipContainer = d3.select('.c3-tooltip-container'), - top = Math.floor(+tooltipContainer.style('top').replace(/px/, '')), - left = Math.floor(+tooltipContainer.style('left').replace(/px/, '')), - topExpected = 115, - leftExpected = 280; - expect(top).toBe(topExpected); - expect(left).toBeGreaterThan(leftExpected); - }); - - }); - - describe('with left margin', function () { - - it('should set left margin', function () { - d3.select('#chart').style('margin-left', '300px'); - expect(true).toBeTruthy(); - }); - - it('should show tooltip on proper position', function () { - var eventRect = d3.select('.c3-event-rect-2').node(); - window.setMouseEvent(chart, 'mousemove', 100, 100, eventRect); - - var tooltipContainer = d3.select('.c3-tooltip-container'), - top = Math.floor(+tooltipContainer.style('top').replace(/px/, '')), - left = Math.floor(+tooltipContainer.style('left').replace(/px/, '')), - topExpected = 115, - leftExpected = 280; - expect(top).toBe(topExpected); - expect(left).toBeGreaterThan(leftExpected); - }); - - }); - - }); - - describe('tooltip positionFunction', function () { - var topExpected = 37, leftExpected = 79; - - beforeAll(function () { - tooltipConfiguration = { - position: function (data, width, height, element) { - expect(data.length).toBe(args().data.columns.length); - expect(data[0]).toEqual(jasmine.objectContaining({ - index: 2, - value: 100, - id: 'data1' - })); - expect(width).toBeGreaterThan(0); - expect(height).toBeGreaterThan(0); - expect(element).toBe(d3.select('.c3-event-rect-2').node()); - return {top: topExpected, left: leftExpected}; - } - }; - }); - - it('should be set to the coordinate where the function returned', function () { - var eventRect = d3.select('.c3-event-rect-2').node(); - window.setMouseEvent(chart, 'mousemove', 100, 100, eventRect); - - var tooltipContainer = d3.select('.c3-tooltip-container'), - top = Math.floor(+tooltipContainer.style('top').replace(/px/, '')), - left = Math.floor(+tooltipContainer.style('left').replace(/px/, '')); - expect(top).toBe(topExpected); - expect(left).toBe(leftExpected); - }); - }); -}); |