model.opacity = 1;
var labelColors = [],
- tooltipPosition = tooltipPosition = getAveragePosition(active);
+ tooltipPosition = getAveragePosition(active);
var tooltipItems = [];
- for (var i = 0, len = active.length; i < len; ++i) {
+ for (i = 0, len = active.length; i < len; ++i) {
tooltipItems.push(createTooltipItem(active[i]));
}
var bodyColor = helpers.color(vm.bodyColor);
var textColor = bodyColor.alpha(opacity * bodyColor.alpha()).rgbString();
- ctx.fillStyle = textColor
+ ctx.fillStyle = textColor;
ctx.font = helpers.fontString(bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily);
// Before Body
helpers.each(vm.beforeBody, fillLineOfText);
var drawColorBoxes = body.length > 1;
- xLinePadding = drawColorBoxes ? (bodyFontSize + 2) : 0
+ xLinePadding = drawColorBoxes ? (bodyFontSize + 2) : 0;
// Draw body lines now
helpers.each(body, function(bodyItem, i) {
}],
afterBody: [],
footer: [],
- x: 269,
- y: 155,
caretPadding: 2,
labelColors: [{
borderColor: 'rgb(255, 0, 0)',
backgroundColor: 'rgb(0, 255, 255)'
}]
}));
+
+ expect(tooltip._view.x).toBeCloseToPixel(269);
+ expect(tooltip._view.y).toBeCloseToPixel(155);
});
it('Should display in single mode', function() {
}],
afterBody: [],
footer: [],
- x: 269,
- y: 312,
caretPadding: 2,
labelColors: []
}));
+
+ expect(tooltip._view.x).toBeCloseToPixel(269);
+ expect(tooltip._view.y).toBeCloseToPixel(312);
});
it('Should display information from user callbacks', function() {
}],
afterBody: ['afterBody'],
footer: ['beforeFooter', 'footer', 'afterFooter'],
- x: 216,
- y: 190,
caretPadding: 2,
labelColors: [{
borderColor: 'rgb(255, 0, 0)',
backgroundColor: 'rgb(0, 255, 255)'
}]
}));
+
+ expect(tooltip._view.x).toBeCloseToPixel(216);
+ expect(tooltip._view.y).toBeCloseToPixel(190);
});
it('Should display information from user callbacks', function() {
}],
afterBody: [],
footer: [],
- x: 269,
- y: 155,
labelColors: [{
borderColor: 'rgb(0, 0, 255)',
backgroundColor: 'rgb(0, 255, 255)'
backgroundColor: 'rgb(0, 255, 0)'
}]
}));
+
+ expect(tooltip._view.x).toBeCloseToPixel(269);
+ expect(tooltip._view.y).toBeCloseToPixel(155);
});
});