2009-02-02 14:36:08 +00:00
|
|
|
/*
|
|
|
|
* tabs_core.js
|
|
|
|
*/
|
2009-02-04 09:35:52 +00:00
|
|
|
var el;
|
|
|
|
|
2009-02-02 14:36:08 +00:00
|
|
|
(function($) {
|
|
|
|
|
|
|
|
module("tabs: core");
|
|
|
|
|
2009-12-25 18:25:46 +00:00
|
|
|
test('navigation markup', function() {
|
|
|
|
el = $('#tabs3').tabs();
|
|
|
|
ok($('#tabs3-list').hasClass('ui-tabs-nav'), 'custom markup; allow list to be any descendant');
|
|
|
|
el.tabs('destroy');
|
|
|
|
|
|
|
|
el = $('#tabs4').tabs();
|
|
|
|
ok($('#tabs4-list').hasClass('ui-tabs-nav'), 'first list found becomes nav - ul');
|
|
|
|
el.tabs('destroy');
|
|
|
|
|
|
|
|
el = $('#tabs4a').tabs();
|
|
|
|
ok($('#tabs4a-list').hasClass('ui-tabs-nav'), 'first list found becomes nav - ol');
|
|
|
|
el.tabs('destroy');
|
|
|
|
|
|
|
|
el = $('#tabs5').tabs();
|
|
|
|
ok($('#tabs5-list').hasClass('ui-tabs-nav'), 'empty list can be used');
|
|
|
|
el.tabs('destroy');
|
|
|
|
});
|
|
|
|
|
2009-02-18 21:44:34 +00:00
|
|
|
test('ajax', function() {
|
|
|
|
expect(4);
|
|
|
|
stop();
|
|
|
|
|
|
|
|
el = $('#tabs2');
|
|
|
|
|
|
|
|
el.tabs({
|
|
|
|
selected: 2,
|
|
|
|
load: function() {
|
|
|
|
// spinner: default spinner
|
2010-04-02 16:43:22 +00:00
|
|
|
setTimeout(function() {
|
|
|
|
equals($('li:eq(2) > a > span', el).length, 1, "should restore tab markup after spinner is removed");
|
|
|
|
equals($('li:eq(2) > a > span', el).html(), '3', "should restore tab label after spinner is removed");
|
|
|
|
el.tabs('destroy');
|
|
|
|
el.tabs({
|
|
|
|
selected: 2,
|
|
|
|
spinner: '<img src="spinner.gif" alt="">',
|
|
|
|
load: function() {
|
|
|
|
// spinner: image
|
|
|
|
equals($('li:eq(2) > a > span', el).length, 1, "should restore tab markup after spinner is removed");
|
|
|
|
equals($('li:eq(2) > a > span', el).html(), '3', "should restore tab label after spinner is removed");
|
|
|
|
start();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}, 1);
|
2009-02-18 21:44:34 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2009-12-25 18:25:46 +00:00
|
|
|
|
2009-02-02 14:36:08 +00:00
|
|
|
})(jQuery);
|