]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
fixes #7777
authorfat <jacobthornton@gmail.com>
Thu, 18 Jul 2013 06:30:05 +0000 (23:30 -0700)
committerfat <jacobthornton@gmail.com>
Thu, 18 Jul 2013 06:30:05 +0000 (23:30 -0700)
js/tests/unit/tooltip.js

index 6105055889ea3c5cb8e760ec05a20b9cd7c266d0..5f7847e9250fd78fa52f57145db5268299a35aa2 100644 (file)
@@ -305,4 +305,40 @@ $(function () {
         ok( Math.round(target.offset().top + target[0].offsetHeight/2 - tooltip[0].offsetHeight/2) === Math.round(tooltip.offset().top) )
         target.tooltip('hide')
       })
+
+      test("tooltip title test #1", function () {
+        var tooltip = $('<a href="#" rel="tooltip" title="Simple tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>')
+          .appendTo('#qunit-fixture')
+          .tooltip({
+          })
+          .tooltip('show')
+        equal($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title from title attribute is set')
+        tooltip.tooltip('hide')
+        ok(!$(".tooltip").length, 'tooltip removed')
+      })
+
+      test("tooltip title test #2", function () {
+        var tooltip = $('<a href="#" rel="tooltip" title="Simple tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>')
+          .appendTo('#qunit-fixture')
+          .tooltip({
+            title: 'This is a tooltip with some content'
+          })
+          .tooltip('show')
+        equal($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title is set from title attribute while prefered over title option')
+        tooltip.tooltip('hide')
+        ok(!$(".tooltip").length, 'tooltip removed')
+      })
+
+      test("tooltip title test #3", function () {
+        var tooltip = $('<a href="#" rel="tooltip" style="display: inline-block; position: absolute; top: 0; left: 0;"></a>')
+          .appendTo('#qunit-fixture')
+          .tooltip({
+            title: 'This is a tooltip with some content'
+          })
+          .tooltip('show')
+        equal($('.tooltip').children('.tooltip-inner').text(), 'This is a tooltip with some content', 'title from title option is set')
+        tooltip.tooltip('hide')
+        ok(!$(".tooltip").length, 'tooltip removed')
+      })
+
 })