Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 5071221

Browse files
committed
respect page loading times and comment on assumption in degradeInputs test
1 parent def90bf commit 5071221

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

tests/unit/degradeInputs/degradeInputs.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,35 @@
99
same($('input#not-to-be-degraded').attr("type"), "range");
1010
});
1111

12-
test('should degrade input type to a different type, as specified in page options', function(){
12+
asyncTest('should degrade input type to a different type, as specified in page options', function(){
1313
var degradeInputs = $.mobile.page.prototype.options.degradeInputs;
1414

1515
expect( degradeInputs.length );
1616

17-
// Initialize dialog page
18-
$.mobile.changePage($('#dialog'));
19-
$.mobile.changePage($('#page'));
17+
// NOTE the initial page is already enhanced (or expected to be) so we load the dialog to enhance it
18+
// and _expect_ that the default page will remain "unreaped". This will break if that assumption changes
19+
$.testHelper.pageSequence([
20+
function() {
21+
$.mobile.changePage( "#dialog" );
22+
},
2023

21-
$.each(degradeInputs, function( oldType, newType ) {
22-
if (newType === false) {
23-
newType = oldType;
24-
}
24+
function() {
25+
$.each(degradeInputs, function( oldType, newType ) {
26+
if (newType === false) {
27+
newType = oldType;
28+
}
29+
30+
$('#page-test-container').html('<input type="' + oldType + '" />').trigger("create");
2531

26-
$('#page-test-container').html('<input type="' + oldType + '" />').trigger("create");
32+
same($('#page-test-container input').attr("type"), newType, "type attr on page is: " + newType);
2733

28-
same($('#page-test-container input').attr("type"), newType);
34+
$('#dialog-test-container').html('<input type="' + oldType + '" />').trigger("create");
2935

30-
$('#dialog-test-container').html('<input type="' + oldType + '" />').trigger("create");
36+
same($('#dialog-test-container input').attr("type"), newType, "type attr on dialog is: " + newType);
37+
});
3138

32-
same($('#dialog-test-container input').attr("type"), newType);
33-
});
39+
start();
40+
}
41+
]);
3442
});
3543
})(jQuery);

0 commit comments

Comments
 (0)