Commit 60c14160 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix legend spec

parent e1e3ddcf
...@@ -3091,7 +3091,7 @@ ...@@ -3091,7 +3091,7 @@
.style("fill-opacity", opacityForText)); .style("fill-opacity", opacityForText));
}; };
c3_chart_internal_fn.getTextRect = function (text, cls) { c3_chart_internal_fn.getTextRect = function (text, cls) {
var svg = this.d3.select('body').append("svg").style('visibility', 'hidden'), rect; var svg = this.d3.select('body').attr('class', 'c3').append("svg").style('visibility', 'hidden'), rect;
svg.selectAll('.dummy') svg.selectAll('.dummy')
.data([text]) .data([text])
.enter().append('text') .enter().append('text')
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -23,7 +23,9 @@ describe('c3 chart legend', function () { ...@@ -23,7 +23,9 @@ describe('c3 chart legend', function () {
} }
chart = window.c3.generate(args); chart = window.c3.generate(args);
d3 = chart.internal.d3; d3 = chart.internal.d3;
chart.internal.d3.select('.jasmine_html-reporter').style('display', 'none'); chart.internal.d3.select('.jasmine_html-reporter')
.style('position', 'absolute')
.style('right', 0);
window.setTimeout(function () { window.setTimeout(function () {
done(); done();
...@@ -34,7 +36,7 @@ describe('c3 chart legend', function () { ...@@ -34,7 +36,7 @@ describe('c3 chart legend', function () {
it('should be located on the center of chart', function () { it('should be located on the center of chart', function () {
var box = chart.internal.legend.node().getBoundingClientRect(); var box = chart.internal.legend.node().getBoundingClientRect();
expect(box.left + box.right).toBe(645); expect(box.left + box.right).toBe(640);
}); });
}); });
......
...@@ -48,7 +48,7 @@ c3_chart_internal_fn.addTransitionForText = function (transitions, xForText, yFo ...@@ -48,7 +48,7 @@ c3_chart_internal_fn.addTransitionForText = function (transitions, xForText, yFo
.style("fill-opacity", opacityForText)); .style("fill-opacity", opacityForText));
}; };
c3_chart_internal_fn.getTextRect = function (text, cls) { c3_chart_internal_fn.getTextRect = function (text, cls) {
var svg = this.d3.select('body').append("svg").style('visibility', 'hidden'), rect; var svg = this.d3.select('body').attr('class', 'c3').append("svg").style('visibility', 'hidden'), rect;
svg.selectAll('.dummy') svg.selectAll('.dummy')
.data([text]) .data([text])
.enter().append('text') .enter().append('text')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment