]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Added test to fix for #5362 5366/head
authorKevin Attfield <k.attfield@gmail.com>
Tue, 9 Oct 2012 05:29:44 +0000 (22:29 -0700)
committerKevin Attfield <k.attfield@gmail.com>
Tue, 9 Oct 2012 05:29:44 +0000 (22:29 -0700)
js/tests/unit/bootstrap-tab.js

index 9878047810dd0be1a8595e112d3aa20a8b0895cc..40f9a7406d809831e912ff8960f33ccb33cfe0f0 100644 (file)
@@ -58,4 +58,23 @@ $(function () {
           .tab('show')
       })
 
+      test("show and shown events should reference correct relatedTarget", function () {
+        var dropHTML =
+            '<ul class="drop">'
+          + '<li class="dropdown"><a data-toggle="dropdown" href="#">1</a>'
+          + '<ul class="dropdown-menu">'
+          + '<li><a href="#1-1" data-toggle="tab">1-1</a></li>'
+          + '<li><a href="#1-2" data-toggle="tab">1-2</a></li>'
+          + '</ul>'
+          + '</li>'
+          + '</ul>'
+
+        $(dropHTML).find('ul>li:first a').tab('show').end()
+          .find('ul>li:last a').on('show', function(event){
+            equals(event.relatedTarget.hash, "#1-1")
+          }).on('shown', function(event){
+            equals(event.relatedTarget.hash, "#1-1")
+          }).tab('show')
+      })
+
 })
\ No newline at end of file