Replace ineffective test with a fixture (#7491)

This commit is contained in:
Jukka Kurkela 2020-06-12 01:21:10 +03:00 committed by GitHub
parent 281ee42def
commit 0b3ef9c1a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 25 deletions

View 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();
}

View File

@ -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
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View 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',