Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

listview filter inset respects prototype options Fixes #3761

  • Loading branch information...
commit 748ada1f441ca8c6d2824d489000d6e8809ec62d 1 parent bee587d
@johnbender johnbender authored
View
2  js/jquery.mobile.listview.filter.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" );
}
View
13 tests/unit/listview/index.html
@@ -332,5 +332,18 @@ <h2 id="qunit-userAgent"></h2>
</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>
View
45 tests/unit/listview/listview_core.js
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.