mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-17 13:46:49 +01:00
Add sanity check for stepSize (#9679)
This commit is contained in:
@@ -639,6 +639,29 @@ describe('Linear Scale', function() {
|
||||
expect(getLabels(chart.scales.y)).toEqual(['1', '3', '5', '7', '9', '11']);
|
||||
});
|
||||
|
||||
it('Should not generate insane amounts of ticks with small stepSize and large range', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'bar',
|
||||
options: {
|
||||
scales: {
|
||||
y: {
|
||||
type: 'linear',
|
||||
min: 1,
|
||||
max: 1E10,
|
||||
ticks: {
|
||||
stepSize: 2,
|
||||
autoSkip: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
expect(chart.scales.y.min).toBe(1);
|
||||
expect(chart.scales.y.max).toBe(1E10);
|
||||
expect(chart.scales.y.ticks.length).toBeLessThanOrEqual(1000);
|
||||
});
|
||||
|
||||
it('Should create decimal steps if stepSize is a decimal number', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'bar',
|
||||
|
||||
Reference in New Issue
Block a user