]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Arrow replacement
authorGuillaume Gautreau <guillaume+github@ghusse.com>
Sat, 26 Jan 2013 20:45:21 +0000 (21:45 +0100)
committerGuillaume Gautreau <guillaume+github@ghusse.com>
Sat, 26 Jan 2013 20:45:21 +0000 (21:45 +0100)
js/tests/unit/bootstrap-tooltip.js

index 49c034e2ff931aa121cbdacf15b17d2b445904f9..666c417ee1cff10c0b05f34e6d4cf3dbfd9b7056 100644 (file)
@@ -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 = $("<div />").appendTo("body")
+            .css({position: "absolute", bottom: 0, left: 0, textAlign: "right", width: 300, height: 300})
+          , p = $("<p style='margin-top:200px' />").appendTo(container)
+          , tooltiped = $("<a href='#' title='very very very very very very very long tooltip'>Hover me</a>")
+            .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);
+      });
 })