From 5071221291f1b3ddeb8dcbfc596c4e5eaa0a8837 Mon Sep 17 00:00:00 2001 From: John Bender Date: Fri, 9 Dec 2011 12:52:53 -0800 Subject: [PATCH] respect page loading times and comment on assumption in degradeInputs test --- tests/unit/degradeInputs/degradeInputs.js | 40 ++++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/tests/unit/degradeInputs/degradeInputs.js b/tests/unit/degradeInputs/degradeInputs.js index 487a6934..fef36d6d 100644 --- a/tests/unit/degradeInputs/degradeInputs.js +++ b/tests/unit/degradeInputs/degradeInputs.js @@ -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('').trigger("create"); + + same($('#page-test-container input').attr("type"), newType, "type attr on page is: " + newType); + + $('#dialog-test-container').html('').trigger("create"); + + same($('#dialog-test-container input').attr("type"), newType, "type attr on dialog is: " + newType); + }); + + start(); } - - $('#page-test-container').html('').trigger("create"); - - same($('#page-test-container input').attr("type"), newType); - - $('#dialog-test-container').html('').trigger("create"); - - same($('#dialog-test-container input').attr("type"), newType); - }); + ]); }); })(jQuery); \ No newline at end of file