]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
put the tooltips into the DOM in the tooltip unit tests
authorChris Rebert <code@rebertia.com>
Fri, 6 Jun 2014 22:30:44 +0000 (15:30 -0700)
committerChris Rebert <code@rebertia.com>
Sun, 8 Jun 2014 00:54:11 +0000 (17:54 -0700)
js/tests/unit/tooltip.js

index 81c0fdf736279b8c8d2a448b15a217d015487f48..f4c840d840e34628a03ea7e15b6196f09237b666 100644 (file)
@@ -118,9 +118,11 @@ $(function () {
 
   test('should fire shown event', function () {
     stop()
-    $('<div title="tooltip title"></div>')
+    var tooltip = $('<div title="tooltip title"></div>').appendTo('#qunit-fixture')
+    tooltip
       .on('shown.bs.tooltip', function () {
         ok(true, 'shown was called')
+        tooltip.remove()
         start()
       })
       .bootstrapTooltip('show')
@@ -142,12 +144,14 @@ $(function () {
 
   test('should fire hide event', function () {
     stop()
-    $('<div title="tooltip title"></div>')
+    var tooltip = $('<div title="tooltip title"></div>').appendTo('#qunit-fixture')
+    tooltip
       .on('shown.bs.tooltip', function () {
         $(this).bootstrapTooltip('hide')
       })
       .on('hide.bs.tooltip', function () {
         ok(true, 'hide was called')
+        tooltip.remove()
         start()
       })
       .bootstrapTooltip('show')
@@ -155,12 +159,14 @@ $(function () {
 
   test('should fire hidden event', function () {
     stop()
-    $('<div title="tooltip title"></div>')
+    var tooltip = $('<div title="tooltip title"></div>').appendTo('#qunit-fixture')
+    tooltip
       .on('shown.bs.tooltip', function () {
         $(this).bootstrapTooltip('hide')
       })
       .on('hidden.bs.tooltip', function () {
         ok(true, 'hidden was called')
+        tooltip.remove()
         start()
       })
       .bootstrapTooltip('show')
@@ -168,13 +174,15 @@ $(function () {
 
   test('should not fire hidden event when default prevented', function () {
     stop()
-    $('<div title="tooltip title"></div>')
+    var tooltip = $('<div title="tooltip title"></div>').appendTo('#qunit-fixture')
+    tooltip
       .on('shown.bs.tooltip', function () {
         $(this).bootstrapTooltip('hide')
       })
       .on('hide.bs.tooltip', function (e) {
         e.preventDefault()
         ok(true, 'hide was called')
+        tooltip.remove()
         start()
       })
       .on('hidden.bs.tooltip', function () {