respect page loading times and comment on assumption in degradeInputs test

This commit is contained in:
John Bender 2011-12-09 12:52:53 -08:00
parent def90bf230
commit 5071221291

View file

@ -9,27 +9,35 @@
same($('input#not-to-be-degraded').attr("type"), "range");
});
test('should degrade input type to a different type, as specified in page options', function(){
asyncTest('should degrade input type to a different type, as specified in page options', function(){
var degradeInputs = $.mobile.page.prototype.options.degradeInputs;
expect( degradeInputs.length );
// Initialize dialog page
$.mobile.changePage($('#dialog'));
$.mobile.changePage($('#page'));
// NOTE the initial page is already enhanced (or expected to be) so we load the dialog to enhance it
// and _expect_ that the default page will remain "unreaped". This will break if that assumption changes
$.testHelper.pageSequence([
function() {
$.mobile.changePage( "#dialog" );
},
$.each(degradeInputs, function( oldType, newType ) {
if (newType === false) {
newType = oldType;
function() {
$.each(degradeInputs, function( oldType, newType ) {
if (newType === false) {
newType = oldType;
}
$('#page-test-container').html('<input type="' + oldType + '" />').trigger("create");
same($('#page-test-container input').attr("type"), newType, "type attr on page is: " + newType);
$('#dialog-test-container').html('<input type="' + oldType + '" />').trigger("create");
same($('#dialog-test-container input').attr("type"), newType, "type attr on dialog is: " + newType);
});
start();
}
$('#page-test-container').html('<input type="' + oldType + '" />').trigger("create");
same($('#page-test-container input').attr("type"), newType);
$('#dialog-test-container').html('<input type="' + oldType + '" />').trigger("create");
same($('#dialog-test-container input').attr("type"), newType);
});
]);
});
})(jQuery);