diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index 49c034e2ff..666c417ee1 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -290,5 +290,26 @@ $(function () { ok(tooltip.offset().top + tooltip.outerHeight() <= tooltiped.offset().top); container.remove(); }, 100) - }) + }); + + test("arrow should point to element", function(){ + var container = $("
").appendTo("body") + .css({position: "absolute", bottom: 0, left: 0, textAlign: "right", width: 300, height: 300}) + , p = $("").appendTo(container) + , tooltiped = $("Hover me") + .css({marginTop: 200}) + .appendTo(p) + .tooltip({placement: "top", animate: false}) + .tooltip("show"); + + stop(); + + setTimeout(function(){ + var arrow = container.find(".tooltip-arrow"); + + start(); + ok(Math.abs(arrow.offset().left - tooltiped.offset().left - tooltiped.outerWidth()/2) <= 1); + container.remove(); + }, 100); + }); })