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

Commit

Permalink
Added tests for issue #3529: collapsible set with dynamic content
Browse files Browse the repository at this point in the history
  • Loading branch information
gseguin committed Feb 23, 2012
1 parent 60f20e0 commit ec3e602
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/unit/collapsible/collapsible_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/collapsible/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,14 @@ <h3>Section D</h3>
</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.