Permalink
Browse files

listview filter inset respects prototype options Fixes #3761

  • Loading branch information...
johnbender committed Mar 7, 2012
1 parent bee587d commit 748ada1f441ca8c6d2824d489000d6e8809ec62d
Showing with 58 additions and 2 deletions.
  1. +1 −1 js/jquery.mobile.listview.filter.js
  2. +13 −0 tests/unit/listview/index.html
  3. +44 −1 tests/unit/listview/listview_core.js
@@ -101,7 +101,7 @@ $( document ).delegate( ":jqmData(role='listview')", "listviewcreate", function(
.appendTo( wrapper )
.textinput();
if ( $( this ).jqmData( "inset" ) ) {
if ( listview.options.inset ) {
wrapper.addClass( "ui-listview-filter-inset" );
}
@@ -332,5 +332,18 @@ <h1>Basic List View</h1>
</div>
</div>
<div id="list-inset-filter-prototype" data-nstest-theme="b">
<ul data-nstest-role="listview" data-nstest-filter="true">
<li>foo</li>
<li>bar</li>
</ul>
</div>
<div id="list-inset-filter-data-attr" data-nstest-theme="b">
<ul data-nstest-role="listview" data-nstest-filter="true" data-nstest-inset="true">
<li>foo</li>
<li>bar</li>
</ul>
</div>
</body>
</html>
@@ -4,7 +4,8 @@
// TODO split out into seperate test files
(function($){
var home = $.mobile.path.parseUrl( location.href ).pathname + location.search;
var home = $.mobile.path.parseUrl( location.href ).pathname + location.search,
insetVal = $.mobile.listview.prototype.options.inset;
$.mobile.defaultTransition = "none";
@@ -19,6 +20,10 @@
$.mobile.changePage( home );
}
},
teardown: function() {
$.mobile.listview.prototype.options.inset = insetVal;
}
});
@@ -789,4 +794,42 @@
start
]);
});
asyncTest( "list filter is inset from prototype options value", function() {
$.mobile.listview.prototype.options.inset = true;
$("#list-inset-filter-prototype").page();
$.testHelper.pageSequence([
function() {
$.mobile.changePage("#list-inset-filter-prototype");
},
function( timedOut) {
ok( !timedOut );
same( $.mobile.activePage.find("form.ui-listview-filter-inset").length, 1, "form is inset");
window.history.back();
},
start
]);
});
asyncTest( "list filter is inset from data attr value", function() {
$.mobile.listview.prototype.options.inset = false;
$("#list-inset-filter-data-attr").page();
$.testHelper.pageSequence([
function() {
$.mobile.changePage("#list-inset-filter-data-attr");
},
function( timedOut) {
ok( !timedOut );
same( $.mobile.activePage.find("form.ui-listview-filter-inset").length, 1, "form is inset");
window.history.back();
},
start
]);
});
})(jQuery);

0 comments on commit 748ada1

Please sign in to comment.