function uiTest(testSet) {
deserializeTests(testSet, $('#tests'), "");
}
function uiTestLog(msg) {
$('#foo-container').prepend('
' + msg + '
');
}
$(function() {
$('body').append('');
$('#blackhole').css({width: 0, height: 0, overflow: 'hidden'});
$('body').append('
');
});
function deserializeTests( jsObj, dl, path ) {
$.each( jsObj, function(name, value) {
if ( typeof value == 'object' ) {
dl.append('' + ((name.length) ? name : '[default]') + '');
var dd = $( document.createElement( 'dd' ) ).appendTo( dl );
var newDl = $( document.createElement( 'dl' ) ).appendTo( dd );
deserializeTests( value, newDl, path + name + '-' );
} else {
dl.append('' + ((name.length) ? path + name : '[default]') + '');
var dd = $( document.createElement( 'dd' ) ).appendTo( dl );
var link = $( document.createElement( 'a' ) ).appendTo( dd );
link
.attr( 'href', '#' )
.text( value )
.click(function() {
$( '#foo-container' ).remove();
$( '#foo' ).remove();
$( '#blackhole' ).append( '' );
$( '#foo' )
.html( '' + value + '
' )
.prepend( '' + path + ((name.length) ? name : '[default]') + '
' );
$( this ).after( '' + name + '');
errDl.append('
' + value + '
');
});
link.after('
' + err + '
');
} finally {
return false;
}
});
}
});
}