diff --git a/tests/unit/listview/index.html b/tests/unit/listview/index.html
index 8d210fb6d7e..3757f2c640f 100644
--- a/tests/unit/listview/index.html
+++ b/tests/unit/listview/index.html
@@ -281,21 +281,6 @@
diff --git a/tests/unit/listview/listview_core.js b/tests/unit/listview/listview_core.js
index 2c905fa1730..b437b80e998 100755
--- a/tests/unit/listview/listview_core.js
+++ b/tests/unit/listview/listview_core.js
@@ -418,10 +418,11 @@
]);
});
- module( "Search Filter" );
+ module( "Search Filter");
var searchFilterId = "#search-filter-test";
+
asyncTest( "Filter downs results when the user enters information", function() {
var $searchPage = $(searchFilterId);
$.testHelper.pageSequence([
@@ -595,96 +596,6 @@
]);
});
- module( "Custom search filter", {
- setup: function() {
- var self = this;
- this._refreshCornersCount = 0;
- this._refreshCornersFn = $.mobile.listview.prototype._refreshCorners;
-
- this.startTest = function() {
- return this._refreshCornersCount === 1;
- };
-
- // _refreshCorners is the last method called in the filter loop
- // so we count the number of times _refreshCorners gets invoked to stop the test
- $.mobile.listview.prototype._refreshCorners = function() {
- self._refreshCornersCount += 1;
- self._refreshCornersFn.apply( this, arguments );
- if ( self.startTest() ) {
- start();
- }
- }
- },
- teardown: function() {
- $.mobile.listview.prototype._refreshCorners = this._refreshCornersFn;
- }
- });
-
- asyncTest( "Custom filterCallback should cause iteration on all list elements", function(){
- var listPage = $( "#search-customfilter-test" ),
- filterCallbackCount = 0,
- expectedCount = 2 * listPage.find("li").length;
- expect( 1 );
-
- this.startTest = function() {
- if ( this._refreshCornersCount === 3 ) {
- equal( filterCallbackCount, expectedCount, "filterCallback should be call exactly "+ expectedCount +" times" );
- }
- return this._refreshCornersCount === 3;
- }
-
- $.testHelper.pageSequence( [
- function(){
- //reset for relative url refs
- $.mobile.changePage( home );
- },
-
- function() {
- $.mobile.changePage( "#search-customfilter-test" );
- },
-
- function() {
- // set the listview instance callback
- listPage.find( "ul" ).listview( "option", "filterCallback", function( text, searchValue, item ) {
- filterCallbackCount += 1;
-
- return text.toString().toLowerCase().indexOf( searchValue ) === -1;
- });
-
- // trigger a change in the search filter
- listPage.find( "input" ).val( "at" ).trigger( "change" );
- listPage.find( "input" ).val( "atw" ).trigger( "change" );
-
- }
- ]);
- });
-
- asyncTest( "filterCallback can be altered after widget creation", function(){
- var listPage = $( "#search-customfilter-test" );
- expect( listPage.find("li").length );
-
- $.testHelper.pageSequence( [
- function(){
- //reset for relative url refs
- $.mobile.changePage( home );
- },
-
- function() {
- $.mobile.changePage( "#search-customfilter-test" );
- },
-
- function() {
- // set the listview instance callback
- listPage.find( "ul" ).listview( "option", "filterCallback", function() {
- ok( true, "custom callback invoked" );
- });
-
- // trigger a change in the search filter
- listPage.find( "input" ).val( "foo" ).trigger( "change" );
- }
- ]);
- });
-
module( "Programmatically generated list items", {
setup: function(){
var item,
@@ -882,6 +793,35 @@
]);
});
+ asyncTest( "filterCallback can be altered after widget creation", function(){
+ var listPage = $( "#search-filter-test" );
+ expect( listPage.find("li").length );
+
+ $.testHelper.pageSequence( [
+ function(){
+ //reset for relative url refs
+ $.mobile.changePage( home );
+ },
+
+ function() {
+ $.mobile.changePage( "#search-filter-test" );
+ },
+
+ function() {
+ // set the listview instance callback
+ listPage.find( "ul" ).listview( "option", "filterCallback", function() {
+ ok(true, "custom callback invoked");
+ });
+
+ // trigger a change in the search filter
+ listPage.find( "input" ).val( "foo" ).trigger( "change" );
+
+ //NOTE beware a poossible issue with timing here
+ start();
+ }
+ ]);
+ });
+
asyncTest( "nested pages hash key is always in the hash (replaceState)", function(){
$.testHelper.pageSequence([
function(){