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

Commit

Permalink
Merge pull request #2492 from hpbuniat/search-filter-bar-2416
Browse files Browse the repository at this point in the history
Fix for #2416
  • Loading branch information
gseguin committed Oct 21, 2011
2 parents 769d3e1 + 5bd8f68 commit 08267c3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
3 changes: 1 addition & 2 deletions js/jquery.mobile.listview.filter.js 100644 → 100755
Expand Up @@ -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 ) ) {

Expand Down
31 changes: 22 additions & 9 deletions tests/unit/listview/listview_core.js 100644 → 100755
Expand Up @@ -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();
}
]);
});
Expand All @@ -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');

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 08267c3

Please sign in to comment.