Improve testing on the CI

This commit is contained in:
Evert Timberg
2016-05-28 20:55:20 -04:00
parent b646f6d816
commit 6bc917c8e3
2 changed files with 16 additions and 12 deletions

View File

@@ -282,10 +282,10 @@ module.exports = function(Chart) {
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]));
}
@@ -601,7 +601,7 @@ module.exports = function(Chart) {
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
@@ -615,7 +615,7 @@ module.exports = function(Chart) {
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) {

View File

@@ -109,8 +109,6 @@ describe('tooltip tests', function() {
}],
afterBody: [],
footer: [],
x: 269,
y: 155,
caretPadding: 2,
labelColors: [{
borderColor: 'rgb(255, 0, 0)',
@@ -120,6 +118,9 @@ describe('tooltip tests', function() {
backgroundColor: 'rgb(0, 255, 255)'
}]
}));
expect(tooltip._view.x).toBeCloseToPixel(269);
expect(tooltip._view.y).toBeCloseToPixel(155);
});
it('Should display in single mode', function() {
@@ -218,11 +219,12 @@ describe('tooltip tests', 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() {
@@ -360,8 +362,6 @@ describe('tooltip tests', function() {
}],
afterBody: ['afterBody'],
footer: ['beforeFooter', 'footer', 'afterFooter'],
x: 216,
y: 190,
caretPadding: 2,
labelColors: [{
borderColor: 'rgb(255, 0, 0)',
@@ -371,6 +371,9 @@ describe('tooltip tests', function() {
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() {
@@ -443,8 +446,6 @@ describe('tooltip tests', function() {
}],
afterBody: [],
footer: [],
x: 269,
y: 155,
labelColors: [{
borderColor: 'rgb(0, 0, 255)',
backgroundColor: 'rgb(0, 255, 255)'
@@ -453,5 +454,8 @@ describe('tooltip tests', function() {
backgroundColor: 'rgb(0, 255, 0)'
}]
}));
expect(tooltip._view.x).toBeCloseToPixel(269);
expect(tooltip._view.y).toBeCloseToPixel(155);
});
});