|
|
@ -1,36 +1,27 @@ |
|
|
|
|
|
|
|
describe('c3 chart arc', function () { |
|
|
|
describe('c3 chart axis', function () { |
|
|
|
|
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
var chart, d3, args; |
|
|
|
var chart, args; |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
chart.internal.d3.select('.jasmine_html-reporter') |
|
|
|
|
|
|
|
.style('position', 'absolute') |
|
|
|
|
|
|
|
.style('right', 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.setTimeout(function () { |
|
|
|
|
|
|
|
done(); |
|
|
|
|
|
|
|
}, 50); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('show pie chart', function () { |
|
|
|
describe('show pie chart', function () { |
|
|
|
|
|
|
|
|
|
|
|
args = { |
|
|
|
it('should update args to have pie chart', function () { |
|
|
|
data: { |
|
|
|
args = { |
|
|
|
columns: [ |
|
|
|
data: { |
|
|
|
['data1', 30], |
|
|
|
columns: [ |
|
|
|
['data2', 150], |
|
|
|
['data1', 30], |
|
|
|
['data3', 120] |
|
|
|
['data2', 150], |
|
|
|
], |
|
|
|
['data3', 120] |
|
|
|
type: 'pie' |
|
|
|
], |
|
|
|
} |
|
|
|
type: 'pie' |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
expect(true).toBeTruthy(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('should have correct classes', function () { |
|
|
|
it('should have correct classes', function () { |
|
|
|
var chartArc = d3.select('.c3-chart-arcs'), |
|
|
|
var chartArc = d3.select('.c3-chart-arcs'), |
|
|
@ -69,6 +60,38 @@ describe('c3 chart axis', function () { |
|
|
|
expect(d3.select('.c3-arc-black').attr('d')).toMatch(/M-124\..+,-171\..+A211\..+,211\..+ 0 0,1 -3\..+,-211\..+L0,0Z/); |
|
|
|
expect(d3.select('.c3-arc-black').attr('d')).toMatch(/M-124\..+,-171\..+A211\..+,211\..+ 0 0,1 -3\..+,-211\..+L0,0Z/); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should update args to have empty pie chart', function () { |
|
|
|
|
|
|
|
args = { |
|
|
|
|
|
|
|
data: { |
|
|
|
|
|
|
|
columns: [ |
|
|
|
|
|
|
|
['data1', null], |
|
|
|
|
|
|
|
['data2', null], |
|
|
|
|
|
|
|
['data3', null] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
type: 'pie' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
expect(true).toBeTruthy(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should have correct d attribute', function () { |
|
|
|
|
|
|
|
var chartArc = d3.select('.c3-chart-arcs'), |
|
|
|
|
|
|
|
arcs = { |
|
|
|
|
|
|
|
data1: chartArc.select('.c3-chart-arc.c3-target.c3-target-data1') |
|
|
|
|
|
|
|
.select('g.c3-shapes.c3-shapes-data1.c3-arcs.c3-arcs-data1') |
|
|
|
|
|
|
|
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data1'), |
|
|
|
|
|
|
|
data2: chartArc.select('.c3-chart-arc.c3-target.c3-target-data2') |
|
|
|
|
|
|
|
.select('g.c3-shapes.c3-shapes-data2.c3-arcs.c3-arcs-data2') |
|
|
|
|
|
|
|
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data2'), |
|
|
|
|
|
|
|
data3: chartArc.select('.c3-chart-arc.c3-target.c3-target-data3') |
|
|
|
|
|
|
|
.select('g.c3-shapes.c3-shapes-data3.c3-arcs.c3-arcs-data3') |
|
|
|
|
|
|
|
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data3') |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
expect(arcs.data1.attr('d').indexOf('NaN')).toBe(-1); |
|
|
|
|
|
|
|
expect(arcs.data2.attr('d').indexOf('NaN')).toBe(-1); |
|
|
|
|
|
|
|
expect(arcs.data3.attr('d').indexOf('NaN')).toBe(-1); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|