From 55fa1acbd6f351d56b873eef6c59f72899cece49 Mon Sep 17 00:00:00 2001 From: Mu-An Chiou Date: Fri, 28 Jun 2013 11:05:38 +0100 Subject: Tooltip: apply position class before positioning --- js/tests/unit/tooltip.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'js/tests/unit') diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index 638edefc2..b1bf75e55 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -291,4 +291,18 @@ $(function () { container.remove() }, 100) }) + + test("should add position class before positioning so that position-specific styles are taken into account", function(){ + $("head").append('') + + var container = $("
").appendTo("body") + , target = $('To my right') + .appendTo(container) + .tooltip({placement: 'right'}) + .tooltip('show') + , tooltip = container.find(".tooltip") + + ok( Math.round(target.offset().top + target[0].offsetHeight/2 - tooltip[0].offsetHeight/2) === tooltip.offset().top ) + target.tooltip('hide') + }) }) -- cgit v1.2.3