|
|
@ -19,16 +19,8 @@ describe('c3 chart interaction', function () { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(function (done) { |
|
|
|
beforeEach(function (done) { |
|
|
|
if (typeof chart === 'undefined') { |
|
|
|
chart = window.initChart(chart, args, done); |
|
|
|
window.initDom(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
chart = window.c3.generate(args); |
|
|
|
|
|
|
|
d3 = chart.internal.d3; |
|
|
|
d3 = chart.internal.d3; |
|
|
|
chart.internal.d3.select('.jasmine_html-reporter').style('display', 'none'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.setTimeout(function () { |
|
|
|
|
|
|
|
done(); |
|
|
|
|
|
|
|
}, 10); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('generate event rects', function () { |
|
|
|
describe('generate event rects', function () { |
|
|
@ -50,8 +42,8 @@ describe('c3 chart interaction', function () { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('should have 4 event rects properly', function () { |
|
|
|
it('should have 4 event rects properly', function () { |
|
|
|
var lefts = [77.5, 137, 203.5, 402.5], |
|
|
|
var lefts = [78, 138, 205.5, 407.5], |
|
|
|
widths = [59.5, 66.5, 199, 191.5]; |
|
|
|
widths = [60, 67.5, 202, 194]; |
|
|
|
d3.selectAll('.c3-event-rect').each(function (d, i) { |
|
|
|
d3.selectAll('.c3-event-rect').each(function (d, i) { |
|
|
|
var box = d3.select(this).node().getBoundingClientRect(); |
|
|
|
var box = d3.select(this).node().getBoundingClientRect(); |
|
|
|
expect(box.left).toBe(lefts[i]); |
|
|
|
expect(box.left).toBe(lefts[i]); |
|
|
@ -79,7 +71,7 @@ describe('c3 chart interaction', function () { |
|
|
|
eventRects.each(function () { |
|
|
|
eventRects.each(function () { |
|
|
|
var box = d3.select(this).node().getBoundingClientRect(); |
|
|
|
var box = d3.select(this).node().getBoundingClientRect(); |
|
|
|
expect(box.left).toBe(40.5); |
|
|
|
expect(box.left).toBe(40.5); |
|
|
|
expect(box.width).toBe(590); |
|
|
|
expect(box.width).toBe(598); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -100,8 +92,8 @@ describe('c3 chart interaction', function () { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('should have 4 event rects properly', function () { |
|
|
|
it('should have 4 event rects properly', function () { |
|
|
|
var lefts = [43.5, 191, 349, 494], |
|
|
|
var lefts = [43.5, 193, 353, 500], |
|
|
|
widths = [147.5, 158, 145, 134]; |
|
|
|
widths = [149.5, 160, 147, 136]; |
|
|
|
d3.selectAll('.c3-event-rect').each(function (d, i) { |
|
|
|
d3.selectAll('.c3-event-rect').each(function (d, i) { |
|
|
|
var box = d3.select(this).node().getBoundingClientRect(); |
|
|
|
var box = d3.select(this).node().getBoundingClientRect(); |
|
|
|
expect(box.left).toBe(lefts[i]); |
|
|
|
expect(box.left).toBe(lefts[i]); |
|
|
@ -129,7 +121,7 @@ describe('c3 chart interaction', function () { |
|
|
|
eventRects.each(function () { |
|
|
|
eventRects.each(function () { |
|
|
|
var box = d3.select(this).node().getBoundingClientRect(); |
|
|
|
var box = d3.select(this).node().getBoundingClientRect(); |
|
|
|
expect(box.left).toBe(40.5); |
|
|
|
expect(box.left).toBe(40.5); |
|
|
|
expect(box.width).toBe(590); |
|
|
|
expect(box.width).toBe(598); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|