diff options
author | Guillaume Gautreau <guillaume+github@ghusse.com> | 2013-01-26 17:06:58 +0400 |
---|---|---|
committer | Guillaume Gautreau <guillaume+github@ghusse.com> | 2013-01-26 17:06:58 +0400 |
commit | 929598784f3a2e4f706d5dcd5a41cea207dfd65e (patch) | |
tree | 484e875fb6aa067748dedc0622ae400140215334 | |
parent | 6803ff70f9203595a04c5adb20d7556cd52c5923 (diff) |
Unit test for replacing tooltip inside window
-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) + }); }) |