[vislib/tooltip] fix tests

This commit is contained in:
Spencer Alger 2014-10-20 16:22:11 -07:00
parent d0694465b2
commit edfaceea1f
2 changed files with 7 additions and 0 deletions

View file

@ -128,6 +128,10 @@ define(function (require) {
positionTooltip.getChartBounds = getChartBounds;
positionTooltip.getViewportBounds = getViewportBounds;
positionTooltip.placeToAvoidOverflow = placeToAvoidOverflow;
positionTooltip.removeClone = function () {
$clone && $clone.remove();
$clone = null;
};
return positionTooltip;
});

View file

@ -47,6 +47,7 @@ define(function (require) {
afterEach(function () {
$window.remove();
$window = $chart = $tooltip = null;
posTT.removeClone();
});
function makeEvent(xPercent, yPercent) {
@ -123,6 +124,8 @@ define(function (require) {
// size the tooltip very small so it won't collide with the edges
$tooltip.css({ width: 15, height: 15 });
var size = posTT.getTtSize($tooltip);
expect(size).to.have.property('width', 15);
expect(size).to.have.property('height', 15);
// position the element based on a mouse that is in the middle of the chart
var pos = posTT.getBasePosition(size, makeEvent(0.5, 0.5));