Commit 1eedee35 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Add test for data.values API

parent 3827c569
...@@ -35,18 +35,8 @@ describe('c3 api data', function () { ...@@ -35,18 +35,8 @@ describe('c3 api data', 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('position', 'absolute')
.style('right', 0);
window.setTimeout(function () {
done();
}, 10);
}); });
describe('data()', function () { describe('data()', function () {
...@@ -86,6 +76,19 @@ describe('c3 api data', function () { ...@@ -86,6 +76,19 @@ describe('c3 api data', function () {
}); });
describe('data.values()', function () {
it('should return values for specified target', function () {
var values = chart.data.values('data1'),
expectedValues = [30, 200, 100, 400, 150, 250];
expect(values.length).toBe(6);
values.forEach(function (v, i) {
expect(v).toBe(expectedValues[i]);
});
});
});
describe('data.names()', function () { describe('data.names()', function () {
it('should return data.names specified as argument', function () { it('should return data.names specified as argument', function () {
......
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