Skip to content

Commit e32eb90

Browse files
committed
add Axes.expand test cases for early returns and range sliders
1 parent 0cbaca4 commit e32eb90

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/jasmine/tests/axes_test.js

+32
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,38 @@ describe('Test axes', function() {
14491449
expect(ax._min).toEqual([{val: 0, pad: 0}]);
14501450
expect(ax._max).toEqual([{val: 6, pad: 15}]);
14511451
});
1452+
1453+
it('should return early if no data is given', function() {
1454+
ax = getDefaultAx();
1455+
1456+
expand(ax);
1457+
expect(ax._min).toBeUndefined();
1458+
expect(ax._max).toBeUndefined();
1459+
});
1460+
1461+
it('should return early if `autorange` is falsy', function() {
1462+
ax = getDefaultAx();
1463+
data = [2, 5];
1464+
1465+
ax.autorange = false;
1466+
ax.rangeslider = { autorange: false };
1467+
1468+
expand(ax, data, {});
1469+
expect(ax._min).toBeUndefined();
1470+
expect(ax._max).toBeUndefined();
1471+
});
1472+
1473+
it('should consider range slider `autorange`', function() {
1474+
ax = getDefaultAx();
1475+
data = [2, 5];
1476+
1477+
ax.autorange = false;
1478+
ax.rangeslider = { autorange: true };
1479+
1480+
expand(ax, data, {});
1481+
expect(ax._min).toEqual([{val: 2, pad: 0}]);
1482+
expect(ax._max).toEqual([{val: 5, pad: 0}]);
1483+
});
14521484
});
14531485

14541486
describe('calcTicks and tickText', function() {

0 commit comments

Comments
 (0)