From: Evert Timberg Date: Sun, 17 Apr 2016 12:54:27 +0000 (-0400) Subject: Fix tests X-Git-Tag: 2.1.0~71^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2280%2Fhead;p=thirdparty%2FChart.js.git Fix tests --- diff --git a/test/defaultConfig.tests.js b/test/defaultConfig.tests.js index b0a21458b..d285265f6 100644 --- a/test/defaultConfig.tests.js +++ b/test/defaultConfig.tests.js @@ -74,7 +74,8 @@ describe('Test the doughnut chart default config', function() { labels: ['label1', 'label2', 'label3'], datasets: [{ data: [10, 20, NaN], - backgroundColor: ['red', 'green', 'blue'] + backgroundColor: ['red', 'green', 'blue'], + metaData: [{}, {}, {}] }] }; @@ -82,20 +83,37 @@ describe('Test the doughnut chart default config', function() { text: 'label1', fillStyle: 'red', hidden: false, - index: 0 + index: 0, + strokeStyle: '#000', + lineWidth: 2 }, { text: 'label2', fillStyle: 'green', hidden: false, - index: 1 + index: 1, + strokeStyle: '#000', + lineWidth: 2 }, { text: 'label3', fillStyle: 'blue', hidden: true, - index: 2 + index: 2, + strokeStyle: '#000', + lineWidth: 2 }]; - expect(config.legend.labels.generateLabels(data)).toEqual(expected); + var chart = { + data: data, + options: { + elements: { + arc: { + borderWidth: 2, + borderColor: '#000' + } + } + } + }; + expect(config.legend.labels.generateLabels.call({ chart: chart }, data)).toEqual(expected); }); it('should hide the correct arc when a legend item is clicked', function() { @@ -189,7 +207,8 @@ describe('Test the polar area chart default config', function() { labels: ['label1', 'label2', 'label3'], datasets: [{ data: [10, 20, NaN], - backgroundColor: ['red', 'green', 'blue'] + backgroundColor: ['red', 'green', 'blue'], + metaData: [{}, {}, {}] }] }; @@ -197,20 +216,37 @@ describe('Test the polar area chart default config', function() { text: 'label1', fillStyle: 'red', hidden: false, - index: 0 + index: 0, + strokeStyle: '#000', + lineWidth: 2 }, { text: 'label2', fillStyle: 'green', hidden: false, - index: 1 + index: 1, + strokeStyle: '#000', + lineWidth: 2 }, { text: 'label3', fillStyle: 'blue', hidden: true, - index: 2 + index: 2, + strokeStyle: '#000', + lineWidth: 2 }]; - expect(config.legend.labels.generateLabels(data)).toEqual(expected); + var chart = { + data: data, + options: { + elements: { + arc: { + borderWidth: 2, + borderColor: '#000' + } + } + } + }; + expect(config.legend.labels.generateLabels.call({ chart: chart }, data)).toEqual(expected); }); it('should hide the correct arc when a legend item is clicked', function() {