0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

Merge pull request #5366 from Sinetheta/2.1.2-wip

Fix for #5362
This commit is contained in:
billy gates 2012-10-17 22:30:40 -07:00
commit 24b5e6cb14
2 changed files with 20 additions and 1 deletions

2
js/bootstrap-tab.js vendored
View File

@ -49,7 +49,7 @@
if ( $this.parent('li').hasClass('active') ) return
previous = $ul.find('.active a').last()[0]
previous = $ul.find('.active:last a')[0]
e = $.Event('show', {
relatedTarget: previous

View 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')
})
})