%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
// Test the bar element
describe('Bar element tests', function() {
it('Should correctly identify as in range', function() {
var bar = new Chart.elements.BarElement({
base: 0,
width: 4,
x: 10,
y: 15
});
expect(bar.inRange(10, 15)).toBe(true);
expect(bar.inRange(10, 10)).toBe(true);
expect(bar.inRange(10, 16)).toBe(false);
expect(bar.inRange(5, 5)).toBe(false);
// Test when the y is below the base (negative bar)
var negativeBar = new Chart.elements.BarElement({
base: 0,
width: 4,
x: 10,
y: -15
});
expect(negativeBar.inRange(10, -16)).toBe(false);
expect(negativeBar.inRange(10, 1)).toBe(false);
expect(negativeBar.inRange(10, -5)).toBe(true);
});
it('should get the correct tooltip position', function() {
var bar = new Chart.elements.BarElement({
base: 0,
width: 4,
x: 10,
y: 15
});
expect(bar.tooltipPosition()).toEqual({
x: 10,
y: 15,
});
// Test when the y is below the base (negative bar)
var negativeBar = new Chart.elements.BarElement({
base: -10,
width: 4,
x: 10,
y: -15
});
expect(negativeBar.tooltipPosition()).toEqual({
x: 10,
y: -15,
});
});
it('should get the center', function() {
var bar = new Chart.elements.BarElement({
base: 0,
width: 4,
x: 10,
y: 15
});
expect(bar.getCenterPoint()).toEqual({x: 10, y: 7.5});
});
});