5 test("should provide no conflict", function () {
6 var tab = $.fn.tab.noConflict()
7 ok(!$.fn.tab, 'tab was set back to undefined (org value)')
11 test("should be defined on jquery object", function () {
12 ok($(document.body).tab, 'tabs method is defined')
15 test("should return element", function () {
16 ok($(document.body).tab()[0] == document.body, 'document.body returned')
19 test("should activate element by tab id", function () {
22 + '<li><a href="#home">Home</a></li>'
23 + '<li><a href="#profile">Profile</a></li>'
26 $('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
28 $(tabsHTML).find('li:last a').tab('show')
29 equals($("#qunit-fixture").find('.active').attr('id'), "profile")
31 $(tabsHTML).find('li:first a').tab('show')
32 equals($("#qunit-fixture").find('.active').attr('id'), "home")
35 test("should activate element by tab id", function () {
38 + '<li><a href="#home">Home</a></li>'
39 + '<li><a href="#profile">Profile</a></li>'
42 $('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
44 $(pillsHTML).find('li:last a').tab('show')
45 equals($("#qunit-fixture").find('.active').attr('id'), "profile")
47 $(pillsHTML).find('li:first a').tab('show')
48 equals($("#qunit-fixture").find('.active').attr('id'), "home")
52 test("should not fire closed when close is prevented", function () {
53 $.support.transition = false
55 $('<div class="tab"/>')
56 .on('show.bs.tab', function (e) {
61 .on('shown.bs.tab', function () {
67 test("show and shown events should reference correct relatedTarget", function () {
70 + '<li class="dropdown"><a data-toggle="dropdown" href="#">1</a>'
71 + '<ul class="dropdown-menu">'
72 + '<li><a href="#1-1" data-toggle="tab">1-1</a></li>'
73 + '<li><a href="#1-2" data-toggle="tab">1-2</a></li>'
78 $(dropHTML).find('ul>li:first a').tab('show').end()
79 .find('ul>li:last a').on('show', function(event){
80 equals(event.relatedTarget.hash, "#1-1")
81 }).on('shown', function(event){
82 equals(event.relatedTarget.hash, "#1-1")