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

Fix for #2416 #2492

Merged
merged 5 commits into from
Oct 21, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions js/jquery.mobile.listview.filter.js
100644 → 100755
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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