]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Replace ineffective test with a fixture (#7491)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Thu, 11 Jun 2020 22:21:10 +0000 (01:21 +0300)
committerGitHub <noreply@github.com>
Thu, 11 Jun 2020 22:21:10 +0000 (18:21 -0400)
test/fixture.js
test/fixtures/scale.linear/tiny-numbers.js [new file with mode: 0644]
test/fixtures/scale.linear/tiny-numbers.png [new file with mode: 0644]
test/specs/scale.linear.tests.js

index 745f0bdbd9c3a5414c823c0bf5d45bff43a34f1a..d00eb3f7da2f06a7da46029e485386f936c0c6aa 100644 (file)
@@ -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 (file)
index 0000000..63c720e
--- /dev/null
@@ -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 (file)
index 0000000..d3c0f75
Binary files /dev/null and b/test/fixtures/scale.linear/tiny-numbers.png differ
index 4f4c31dd9b899f0f586f5a28689f2d4d48aaf2de..c011f666c9a8aacdea0011c0c08ea417e4ab3a08 100644 (file)
@@ -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',