2009-02-02 14:36:08 +00:00
|
|
|
/*
|
|
|
|
* tabs_tickets.js
|
|
|
|
*/
|
|
|
|
(function($) {
|
|
|
|
|
|
|
|
module("tabs: tickets");
|
|
|
|
|
2009-02-03 13:37:54 +00:00
|
|
|
test('#2715 - id containing colon', function() {
|
|
|
|
// http://dev.jqueryui.com/ticket/2715
|
|
|
|
expect(4);
|
|
|
|
|
|
|
|
el = $('#tabs2').tabs();
|
|
|
|
ok( $('div.ui-tabs-panel:eq(0)', '#tabs2').is(':visible'), 'first panel should be visible' );
|
|
|
|
ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );
|
|
|
|
|
2011-03-29 02:28:59 +00:00
|
|
|
el.tabs('option', 'active', 1).tabs('option', 'active', 0);
|
2009-02-03 13:37:54 +00:00
|
|
|
ok( $('div.ui-tabs-panel:eq(0)', '#tabs2').is(':visible'), 'first panel should be visible' );
|
|
|
|
ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );
|
|
|
|
|
2009-02-02 14:36:08 +00:00
|
|
|
});
|
|
|
|
|
2009-02-03 13:37:54 +00:00
|
|
|
test('#???? - panel containing inline style', function() {
|
|
|
|
expect(3);
|
|
|
|
|
|
|
|
var inlineStyle = function(property) {
|
|
|
|
return $('#inline-style')[0].style[property];
|
|
|
|
};
|
|
|
|
var expected = inlineStyle('height');
|
|
|
|
|
|
|
|
el = $('#tabs2').tabs();
|
|
|
|
equals(inlineStyle('height'), expected, 'init should not remove inline style');
|
|
|
|
|
2011-03-29 02:28:59 +00:00
|
|
|
el.tabs('option', 'active', 1);
|
2009-02-03 13:37:54 +00:00
|
|
|
equals(inlineStyle('height'), expected, 'show tab should not remove inline style');
|
|
|
|
|
2011-03-29 02:28:59 +00:00
|
|
|
el.tabs('option', 'active', 0);
|
2009-02-03 13:37:54 +00:00
|
|
|
equals(inlineStyle('height'), expected, 'hide tab should not remove inline style');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test('#3627 - Ajax tab with url containing a fragment identifier fails to load', function() {
|
|
|
|
// http://dev.jqueryui.com/ticket/3627
|
|
|
|
expect(1);
|
|
|
|
|
2011-03-27 02:14:17 +00:00
|
|
|
el = $('#tabs2').tabs({
|
2011-03-27 20:37:43 +00:00
|
|
|
active: 2,
|
2011-04-04 21:06:13 +00:00
|
|
|
beforeLoad: function( event, ui ) {
|
2011-03-27 02:14:17 +00:00
|
|
|
event.preventDefault();
|
2011-04-05 15:28:05 +00:00
|
|
|
ok(/test.html$/.test( ui.ajaxSettings.url ), 'should ignore fragment identifier');
|
2011-03-27 02:14:17 +00:00
|
|
|
}
|
|
|
|
});
|
2009-02-03 13:37:54 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('#4033 - IE expands hash to full url and misinterprets tab as ajax', function() {
|
|
|
|
// http://dev.jqueryui.com/ticket/4033
|
|
|
|
expect(1);
|
|
|
|
|
2011-03-27 02:14:17 +00:00
|
|
|
el = $('<div><ul><li><a href="#tab">Tab</a></li></ul><div id="tab"></div></div>');
|
|
|
|
el.appendTo('#main');
|
|
|
|
el.tabs({
|
2011-04-04 21:06:13 +00:00
|
|
|
beforeLoad: function( event, ui ) {
|
2011-03-27 02:14:17 +00:00
|
|
|
event.preventDefault();
|
|
|
|
ok( false, 'should not be an ajax tab');
|
|
|
|
}
|
|
|
|
});
|
2011-03-26 20:49:14 +00:00
|
|
|
|
2011-04-05 15:28:05 +00:00
|
|
|
equals($('a', el).attr('aria-controls'), 'tab', 'aria-contorls attribute is correct');
|
2009-02-03 13:37:54 +00:00
|
|
|
});
|
|
|
|
|
2010-08-12 03:06:41 +00:00
|
|
|
test('#5893 - Sublist in the tab list are considered as tab', function() {
|
|
|
|
// http://dev.jqueryui.com/ticket/5893
|
|
|
|
expect(1);
|
|
|
|
|
|
|
|
el = $('#tabs6').tabs();
|
2011-03-26 20:49:14 +00:00
|
|
|
equals(el.data("tabs").anchors.length, 2, 'should contain 2 tab');
|
2010-08-12 03:06:41 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2010-12-07 21:27:56 +00:00
|
|
|
test('#6710 - selectors are global', function() {
|
|
|
|
// http://bugs.jqueryui.com/ticket/6710
|
|
|
|
expect(1);
|
|
|
|
|
|
|
|
var container = $('\
|
|
|
|
<div>\
|
|
|
|
<div id="tabs_6710">\
|
|
|
|
<ul>\
|
|
|
|
<li><a href="#tabs-1_6710">Nunc tincidunt</a></li>\
|
|
|
|
<li><a href="#tabs-2_6710">Proin dolor</a></li>\
|
|
|
|
</ul>\
|
|
|
|
<div id="tabs-1_6710"> <p>first</p> </div>\
|
|
|
|
<div id="tabs-2_6710"> <p>second</p>\
|
|
|
|
</div>\
|
|
|
|
</div>');
|
|
|
|
container.find('#tabs_6710').tabs();
|
2011-03-29 11:44:01 +00:00
|
|
|
ok( container.find('#tabs-2_6710').is(':hidden'), 'should find panels and add corresponding classes' );
|
2010-12-07 21:27:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2009-02-02 14:36:08 +00:00
|
|
|
})(jQuery);
|