]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Unit test for replacing tooltip inside window
authorGuillaume Gautreau <guillaume+github@ghusse.com>
Sat, 26 Jan 2013 13:06:58 +0000 (14:06 +0100)
committerGuillaume Gautreau <guillaume+github@ghusse.com>
Sat, 26 Jan 2013 13:06:58 +0000 (14:06 +0100)
js/bootstrap-tooltip.js
js/tests/unit/bootstrap-tooltip.js

index 0d8a20f5683475f26843f36c663ac552889e8104..49c3c6be4294730f47dfce6e63a7d445f029190b 100644 (file)
 
       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;
index ef21bd96b47764ed333c04358346eaabd47c1184..94f40f339f60c0fdaf1057f534430bf05836c6e5 100644 (file)
@@ -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)
+      });
 })