diff options
-rw-r--r-- | js/bootstrap-tooltip.js | 2 | ||||
-rw-r--r-- | js/tests/unit/bootstrap-tooltip.js | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 0d8a20f568..49c3c6be42 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -190,7 +190,7 @@ if (offset.left < 0){ delta = -offset.left * 2; - offset.left = 0; + offset.left = .1; $tip.offset(offset); actualWidth = $tip[0].offsetWidth; actualHeight = $tip[0].offsetHeight; diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index ef21bd96b4..94f40f339f 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -251,4 +251,22 @@ $(function () { ok(!$("#qunit-fixture > .tooltip").length, 'not found in parent') tooltip.tooltip('hide') }) + + test("should place tooltip inside window", function(){ + $("#qunit-fixture").show(); + var tooltip = $("<a href='#' title='Very very very very very very very very long tooltip'></a>") + .css({position: "absolute", top:0, left: 0}) + .appendTo("#qunit-fixture") + .tooltip({placement: "top"}) + .tooltip("show"); + + stop(); + + setTimeout(function(){ + ok($(".tooltip").offset().left >= 0); + + start(); + $("#qunit-fixture").hide(); + }, 200) + }); }) |