Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2492 from hpbuniat/search-filter-bar-2416

Fix for #2416
  • Loading branch information...
commit 08267c3d7df44f8b6db40f4b2e4423766201a552 2 parents 769d3e1 + 5bd8f68
@gseguin gseguin authored
View
3  js/jquery.mobile.listview.filter.js 100644 → 100755
@@ -44,8 +44,7 @@ $( ":jqmData(role='listview')" ).live( "listviewcreate", function() {
// Change val as lastval for next execution
$this.jqmData( "lastval" , val );
-
- change = val.replace( new RegExp( "^" + lastval ) , "" );
+ change = val.substr( 0 , lastval.length - 1 ).replace( lastval , "" );
if ( val.length < lastval.length || change.length != ( val.length - lastval.length ) ) {
View
31 tests/unit/listview/listview_core.js 100644 → 100755
@@ -332,10 +332,8 @@
$searchPage.find('input').val('at');
$searchPage.find('input').trigger('change');
- setTimeout(function() {
- same($searchPage.find('li.ui-screen-hidden').length, 2);
- start();
- }, 1000);
+ same($searchPage.find('li.ui-screen-hidden').length, 2);
+ start();
}
]);
});
@@ -351,14 +349,29 @@
$searchPage.find('input').val('a');
$searchPage.find('input').trigger('change');
- setTimeout(function() {
- same($searchPage.find("li[style^='display: none;']").length, 0);
- start();
- }, 1000);
+ same($searchPage.find("li[style^='display: none;']").length, 0);
+ start();
}
]);
});
+ asyncTest( "Filter works fine with \\W- or regexp-special-characters", function() {
+ var $searchPage = $(searchFilterId);
+ $.testHelper.pageSequence([
+ function() {
+ $.testHelper.openPage(searchFilterId);
+ },
+
+ function() {
+ $searchPage.find('input').val('*');
+ $searchPage.find('input').trigger('change');
+
+ same($searchPage.find('li.ui-screen-hidden').length, 4);
+ start();
+ }
+ ]);
+ });
+
test( "Refresh applies thumb styling", function(){
var ul = $('.ui-page-active ul');
@@ -441,7 +454,7 @@
$li = $page.find( "li:visible" );
ok($li.first().hasClass( "ui-corner-top" ), $li.length+" li elements: First visible element should have class ui-corner-top");
ok($li.last().hasClass( "ui-corner-bottom" ), $li.length+" li elements: Last visible element should have class ui-corner-bottom");
- }
+ };
$.testHelper.pageSequence([
function() {
Please sign in to comment.
Something went wrong with that request. Please try again.