From 012eaec45da9e574d7321a57b99540774fe92ed7 Mon Sep 17 00:00:00 2001 From: levidehaan Date: Thu, 9 Aug 2012 01:22:22 -0600 Subject: [PATCH] Revert "Test for issue #4133" This reverts commit ab944662ca5f67b1309af40ffac78a753536949e. Signed-off-by: levidehaan --- tests/unit/listview/index.html | 15 ---- tests/unit/listview/listview_core.js | 122 +++++++-------------------- 2 files changed, 31 insertions(+), 106 deletions(-) diff --git a/tests/unit/listview/index.html b/tests/unit/listview/index.html index f448ec3af6a..8f221f56575 100644 --- a/tests/unit/listview/index.html +++ b/tests/unit/listview/index.html @@ -281,21 +281,6 @@

Split List View

- -
-
-

Filtered List View

-
-
-
    -
  • a is for aquaman
  • -
  • b is for batman
  • -
  • c is for catwoman
  • -
  • d is for darkwing
  • -
-
-
-
diff --git a/tests/unit/listview/listview_core.js b/tests/unit/listview/listview_core.js index d58e5d3f918..51ff0c6388f 100755 --- a/tests/unit/listview/listview_core.js +++ b/tests/unit/listview/listview_core.js @@ -417,10 +417,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([ @@ -594,96 +595,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, @@ -881,6 +792,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(){