UI Tabs: fixed queued tests, review

This commit is contained in:
Klaus Hartl 2008-10-06 21:35:32 +00:00
parent 2f8d6547f2
commit eb3e6499bf

View File

@ -3,12 +3,14 @@
*/ */
(function($) { (function($) {
// need to wait a bit for the pseudo animation...
function defer(defered, ms) { function defer(defered, ms) {
// wait a bit for the pseudo animation... var queue = defer.queue || (defer.queue = []);
stop(); if (!queue.length) stop();
queue.push(defered);
setTimeout(function() { setTimeout(function() {
defered(); queue.shift()();
start(); if (!queue.length) start();
}, ms || 100); }, ms || 100);
} }
@ -193,27 +195,29 @@ module('tabs: Tickets');
}); });
test('panel containing inline style, #????', function() { test('panel containing inline style, #????', function() {
expect(2); expect(3);
var inlineStyle = function(property) { var inlineStyle = function(property) {
return document.getElementById('inline-style').style[property]; return $('#inline-style')[0].style[property];
}; };
var expected = inlineStyle('height'); var expected = inlineStyle('height');
var el = $('#tabs2 > ul').tabs(); var el = $('#tabs2 > ul').tabs();
equals(inlineStyle('height'), expected, 'should not remove inline style after init'); equals(inlineStyle('height'), expected, 'init should not remove inline style');
el.tabs('select', 1); el.tabs('select', 1);
defer(function() { defer(function() {
equals(inlineStyle('height'), expected, 'should not remove inline style after tabs select'); equals(inlineStyle('height'), expected, 'show tab should not remove inline style');
el.tabs('select', 0); el.tabs('select', 0);
defer(function() { defer(function() {
equals(inlineStyle('height'), expected, 'should not remove inline style after tabs select'); equals(inlineStyle('height'), expected, 'hide tab should not remove inline style');
}); });
}); });
}); });
// test('', function() { // test('', function() {
// expect(0); // expect(0);
// //