Skip to content
Browse files

Added tests for issue #3529: collapsible set with dynamic content

  • Loading branch information...
1 parent 60f20e0 commit ec3e602bd2d3389287e7f21636bd18713ccd7fbb @gseguin gseguin committed Feb 22, 2012
Showing with 33 additions and 0 deletions.
  1. +24 −0 tests/unit/collapsible/collapsible_core.js
  2. +9 −0 tests/unit/collapsible/index.html
View
24 tests/unit/collapsible/collapsible_core.js
@@ -116,6 +116,30 @@
]);
});
+ asyncTest( "Collapsible Set with dynamic content", function(){
+ $.testHelper.pageSequence([
+ function(){
+ $.testHelper.openPage( "#collapsible-set-with-dynamic-content" );
+ },
+
+ function() {
+ var set = $( ".ui-page-active" ).find( ".ui-collapsible-set" );
+ for ( var i = 0; i < 3; i++ ) {
+ $( '<div data-'+ $.mobile.ns +'role="collapsible"><h3>Collapsible Item ' + i + '</h3></div>' ).appendTo( set );
+ }
+ set.collapsibleset( "refresh" );
+ equal( set.find( ".ui-collapsible" ).length, 3, "The 3 collapsible should be enhanced" );
+ ok( set.find( ".ui-collapsible" ).eq( 0 ).find( "a" ).hasClass( "ui-corner-top" ), "The 1st collapsible should have top corners" );
+ ok( !set.find( ".ui-collapsible" ).eq( 0 ).find( "a" ).hasClass( "ui-corner-bottom" ), "The 1st collapsible should NOT have bottom corners" );
+ ok( !set.find( ".ui-collapsible" ).eq( 1 ).find( "a" ).hasClass( "ui-corner-top" ), "The 2nd collapsible should NOT have top corners" );
+ ok( !set.find( ".ui-collapsible" ).eq( 1 ).find( "a" ).hasClass( "ui-corner-bottom" ), "The 2nd collapsible should NOT have bottom corners" );
+ ok( set.find( ".ui-collapsible" ).eq( 2 ).find( "a" ).hasClass( "ui-corner-bottom" ), "The 3rd collapsible should have bottom corners" );
+ ok( !set.find( ".ui-collapsible" ).eq( 2 ).find( "a" ).hasClass( "ui-corner-top" ), "The 3rd collapsible should NOT have top corners" );
+ start();
+ }
+ ]);
+ });
+
module( "Theming", {});
asyncTest( "Collapsible", 6, function(){
View
9 tests/unit/collapsible/index.html
@@ -174,5 +174,14 @@ <h2 id="qunit-userAgent"></h2>
</div>
</div>
+<div data-nstest-role="page" id='collapsible-set-with-dynamic-content'>
+ <div data-nstest-role="header">
+ <h1>Collapsible Set with dynamic content</h1>
+ </div>
+ <div data-nstest-role="content">
+ <div data-nstest-role="collapsible-set"></div>
+ </div>
+</div>
+
</body>
</html>

0 comments on commit ec3e602

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