Permalink
Browse files

Issue #3081: Range inputs on dialogs don't degrade

The degradeInputs plugin bails early for pages that do not have
data-role="page". This behavior prevented range inputs (for slider widgets)
from degrading properly when used in dialogs.

Updated degradeInputs unit tests to check dialogs, too.
  • Loading branch information...
eromba committed Nov 21, 2011
1 parent a9d9ca3 commit a8c04855b4c18399a453a84cb4dd802e3a66cdce
@@ -24,7 +24,7 @@ $.mobile.page.prototype.options.degradeInputs = {
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ){
var page = $(e.target).closest(':jqmData(role="page")').data("page"), options;
var page = $(e.target).closest(':jqmData(role="page"),:jqmData(role="dialog")').data("page"), options;
if( !page ) {
return;
@@ -14,15 +14,23 @@
var degradeInputs = $.mobile.page.prototype.options.degradeInputs;
expect( degradeInputs.length );
// Initialize dialog page
$.mobile.changePage($('#dialog'));
$.mobile.changePage($('#page'));
$.each(degradeInputs, function( oldType, newType ) {
if (newType === false) {
newType = oldType;
}
$('#test-container').html('<input type="' + oldType + '" />').trigger("create");
$('#page-test-container').html('<input type="' + oldType + '" />').trigger("create");
same($('#test-container input').attr("type"), newType);
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);
});
});
@@ -25,11 +25,18 @@ <h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div id="foo" data-nstest-role="page">
<div id="page" data-nstest-role="page">
<input id="not-to-be-degraded" type="range" data-nstest-role="nojs" />
<div id="test-container">
<div id="page-test-container">
</div>
</div>
<div id="dialog" data-nstest-role="dialog">
<div id="dialog-test-container">
</div>
</div>

0 comments on commit a8c0485

Please sign in to comment.