From 1eedee352a87eff22bb3dc327c75f1ed25ff2757 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Thu, 20 Nov 2014 08:28:54 +0900 Subject: [PATCH] Add test for data.values API --- spec/api.data-spec.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/spec/api.data-spec.js b/spec/api.data-spec.js index 164743c..39c41f7 100644 --- a/spec/api.data-spec.js +++ b/spec/api.data-spec.js @@ -35,18 +35,8 @@ describe('c3 api data', function () { }; beforeEach(function (done) { - if (typeof chart === 'undefined') { - window.initDom(); - } - chart = window.c3.generate(args); + chart = window.initChart(chart, args, done); 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 () { @@ -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 () { it('should return data.names specified as argument', function () {