Skip to content

Commit

Permalink
Add test "Should not generate any ticks > max if max is specified" (c…
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingMarco committed Feb 5, 2023
1 parent 1f1fd79 commit 707ed83
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/specs/scale.linear.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,28 @@ describe('Linear Scale', function() {
expect(getLabels(chart.scales.y)).toEqual(['1', '3', '5', '7', '9', '11']);
});

it('Should not generate any ticks > max if max is specified', function() {
var chart = window.acquireChart({
type: 'line',
options: {
scales: {
x: {
type: 'linear',
min: 2.404e-8,
max: 2.4143e-8,
ticks: {
includeBounds: false,
},
},
},
},
});

expect(chart.scales.x.min).toBe(2.404e-8);
expect(chart.scales.x.max).toBe(2.4143e-8);
expect(chart.scales.x.ticks[chart.scales.x.ticks.length - 1].value).toBeLessThanOrEqual(2.4143e-8);
});

it('Should not generate insane amounts of ticks with small stepSize and large range', function() {
var chart = window.acquireChart({
type: 'bar',
Expand Down

0 comments on commit 707ed83

Please sign in to comment.