Skip to content

Commit 1507d9c

Browse files
committed
test(axis_utils.test.ts): add test to confirm positive padding
1 parent f8e8f5f commit 1507d9c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/lib/axes/axis_utils.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,4 +1272,15 @@ describe('Axis computational utils', () => {
12721272
expect(isBounded(lowerBounded)).toBe(true);
12731273
expect(isBounded(upperBounded)).toBe(true);
12741274
});
1275+
test('should not allow negative padding', () => {
1276+
const negativePadding = -2;
1277+
// value canvas_text_bbox_calculator changes negative values is 1
1278+
const positivePadding = 1;
1279+
1280+
const bboxCalculator = new CanvasTextBBoxCalculator();
1281+
const negativeReducer = getMaxBboxDimensions(bboxCalculator, 16, 'Arial', 0, negativePadding);
1282+
const positiveReducer = getMaxBboxDimensions(bboxCalculator, 16, 'Arial', 0, positivePadding);
1283+
1284+
expect(JSON.stringify(negativeReducer)).toEqual(JSON.stringify(positiveReducer));
1285+
});
12751286
});

0 commit comments

Comments
 (0)