Skip to content
Browse files

Tests for listview option data-filter-reveal

  • Loading branch information...
1 parent a9c80c5 commit 8969002231d24d347afd9aa6f62fdb39f48ed486 @gseguin gseguin committed Oct 11, 2012
Showing with 63 additions and 0 deletions.
  1. +33 −0 tests/unit/listview/index.html
  2. +30 −0 tests/unit/listview/listview_core.js
View
33 tests/unit/listview/index.html
@@ -330,6 +330,39 @@ <h2 id="qunit-userAgent"></h2>
</div>
</div>
+<!-- Search bar filter -->
+<div data-nstest-role="page" id='search-filter-reveal-test'>
+ <div data-nstest-role="header" data-nstest-position="inline">
+ <h1>Reveal Listview</h1>
+ </div>
+ <div data-nstest-role="content">
+ <ul data-nstest-role="listview" data-nstest-filter="true" data-nstest-filter-reveal="true">
+ <li>Acura</a></li>
+ <li>Audi</li>
+ <li>BMW</li>
+ <li>Cadillac</li>
+ <li>Chrysler</li>
+ <li>Dodge</li>
+ <li>Ferrari</li>
+ <li>Ford</li>
+ <li>GMC</li>
+ <li>Honda</li>
+ <li>Hyundai</li>
+ <li>Infiniti</li>
+ <li>Jeep</li>
+ <li>Kia</li>
+ <li>Lexus</li>
+ <li>Mini</li>
+ <li>Nissan</li>
+ <li>Porsche</li>
+ <li>Subaru</li>
+ <li>Toyota</li>
+ <li>Volkswagon</li>
+ <li>Volvo</li>
+ </ul>
+ </div>
+</div>
+
<!-- Programmatically generated list items !-->
<div data-nstest-role="page" id="programmatically-generated-list">
<ul data-nstest-role="listview" data-nstest-inset="true" id="programmatically-generated-list-items"></ul>
View
30 tests/unit/listview/listview_core.js
@@ -685,6 +685,36 @@
]);
});
+ module( "Search Filter with filterReveal==true" );
+
+ asyncTest( "Filter downs results when the user enters information", 3, function() {
+ var $searchPage = $( "#search-filter-reveal-test" );
+ $.testHelper.pageSequence([
+ function() {
+ $.mobile.changePage( $searchPage );
+ },
+
+ function() {
+ deepEqual( $searchPage.find( 'li.ui-screen-hidden' ).length, 22);
+ },
+
+ function() {
+ $searchPage.find( 'input' ).val( 'a' );
+ $searchPage.find( 'input' ).trigger('change');
+
+ deepEqual( $searchPage.find('li.ui-screen-hidden').length, 11);
+ },
+
+ function() {
+ $searchPage.find( 'input' ).val( '' );
+ $searchPage.find( 'input' ).trigger('change');
+
+ deepEqual( $searchPage.find('li.ui-screen-hidden').length, 22);
+ start();
+ }
+ ]);
+ });
+
module( "Programmatically generated list items", {
setup: function(){
var item,

0 comments on commit 8969002

Please sign in to comment.
Something went wrong with that request. Please try again.