]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
add failing test for #13268
authorChris Rebert <code@rebertia.com>
Fri, 6 Jun 2014 21:49:59 +0000 (14:49 -0700)
committerChris Rebert <code@rebertia.com>
Sun, 8 Jun 2014 00:54:10 +0000 (17:54 -0700)
js/tests/unit/tooltip.js

index 2e175583e5164f81da69475df8bb8f230691eea4..81c0fdf736279b8c8d2a448b15a217d015487f48 100644 (file)
@@ -557,4 +557,31 @@ $(function () {
     $('head #test').remove()
     $('head #viewport-style').remove()
   })
+
+  test('should not error when trying to show an auto-placed tooltip that has been removed from the dom', function () {
+    var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>').appendTo('#qunit-fixture')
+
+    tooltip
+      .one('show.bs.tooltip', function () {
+        tooltip.remove()
+      })
+      .bootstrapTooltip({ placement: 'auto' })
+
+    var passed = true
+    try {
+      tooltip.bootstrapTooltip('show')
+    }
+    catch (err) {
+      passed = false
+      console.log(err)
+    }
+    ok(passed, '.tooltip(\'show\') should not throw an error in this case')
+
+    try {
+      tooltip.remove()
+    }
+    catch (err) {
+      // tooltip may have already been removed
+    }
+  })
 })