From 707ed83e134e19bb98add46cca52c71182b3d363 Mon Sep 17 00:00:00 2001 From: CodingMarco Date: Sun, 5 Feb 2023 23:49:13 +0100 Subject: [PATCH] Add test "Should not generate any ticks > max if max is specified" (#11083) --- test/specs/scale.linear.tests.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/specs/scale.linear.tests.js b/test/specs/scale.linear.tests.js index 9fbe5467a2d..a8ad53995b1 100644 --- a/test/specs/scale.linear.tests.js +++ b/test/specs/scale.linear.tests.js @@ -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',