From: Jukka Kurkela Date: Thu, 11 Jun 2020 22:21:10 +0000 (+0300) Subject: Replace ineffective test with a fixture (#7491) X-Git-Tag: v3.0.0-beta.2~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b3ef9c1a619f7011762f5dd24d972dc8c093e75;p=thirdparty%2FChart.js.git Replace ineffective test with a fixture (#7491) --- diff --git a/test/fixture.js b/test/fixture.js index 745f0bdbd..d00eb3f7d 100644 --- a/test/fixture.js +++ b/test/fixture.js @@ -44,7 +44,7 @@ function specFromFixture(description, inputs) { loadConfig(input, function(json) { var chart = utils.acquireChart(json.config, json.options); if (!inputs.png) { - fail('Missing PNG comparison file for ' + inputs.json); + fail('Missing PNG comparison file for ' + input); done(); } diff --git a/test/fixtures/scale.linear/tiny-numbers.js b/test/fixtures/scale.linear/tiny-numbers.js new file mode 100644 index 000000000..63c720e68 --- /dev/null +++ b/test/fixtures/scale.linear/tiny-numbers.js @@ -0,0 +1,18 @@ +// Should generate max and min that are not equal when data contains values that are very close to each other + +module.exports = { + config: { + type: 'scatter', + data: { + datasets: [{ + data: [ + {x: 1, y: 1.8548483304974972}, + {x: 2, y: 1.8548483304974974}, + ] + }], + }, + }, + options: { + spriteText: true + } +}; diff --git a/test/fixtures/scale.linear/tiny-numbers.png b/test/fixtures/scale.linear/tiny-numbers.png new file mode 100644 index 000000000..d3c0f75ab Binary files /dev/null and b/test/fixtures/scale.linear/tiny-numbers.png differ diff --git a/test/specs/scale.linear.tests.js b/test/specs/scale.linear.tests.js index 4f4c31dd9..c011f666c 100644 --- a/test/specs/scale.linear.tests.js +++ b/test/specs/scale.linear.tests.js @@ -3,6 +3,8 @@ function getLabels(scale) { } describe('Linear Scale', function() { + describe('auto', jasmine.fixture.specs('scale.linear')); + it('Should register the constructor with the scale service', function() { var Constructor = Chart.scaleService.getScaleConstructor('linear'); expect(Constructor).not.toBe(undefined); @@ -1106,30 +1108,6 @@ describe('Linear Scale', function() { expect(chart.scales.x.max).toEqual(0); }); - it('Should generate max and min that are not equal when data contains values that are very close to each other', function() { - var chart = window.acquireChart({ - type: 'scatter', - data: { - datasets: [{ - data: [ - {x: 1, y: 1.8548483304974972}, - {x: 2, y: 1.8548483304974974}, - ] - }], - }, - options: { - scales: { - y: { - type: 'linear', - } - } - } - }); - - expect(chart.scales.y).not.toEqual(undefined); // must construct - expect(chart.scales.y.max).toBeGreaterThan(chart.scales.y.min); - }); - it('Should get correct pixel values when horizontal', function() { var chart = window.acquireChart({ type: 'horizontalBar',