2 * mobile widget unit tests
5 var widgetInitialized = false;
7 module( 'jquery.mobile.widget.js' );
9 $( "#foo" ).live( 'pageinit', function(){
10 // ordering sensitive here, the value has to be set after the call
11 // so that if the widget factory says that its not yet initialized,
12 // which is an exception, the value won't be set
13 $( "#foo-slider" ).slider( 'refresh' );
14 widgetInitialized = true;
17 test( "page is enhanced before init is fired", function() {
18 ok( widgetInitialized );
21 test( "elements within an ignore container are not enhanced when ignoreContentEnabled is true ", function() {
22 $.mobile.ignoreContentEnabled = true;
24 $.mobile.collapsible.prototype.enhanceWithin( $("#ignored") );
26 ok( !$( "#ignored-collapsible" ).hasClass( "ui-collapsible" ), "ignored element doesn't have ui-collapsible" );
28 $.mobile.collapsible.prototype.enhanceWithin( $("#not-ignored") );
30 ok( $( "#collapsible" ).hasClass( "ui-collapsible" ), "identical unignored elements are enahanced" );
32 $.mobile.ignoreContentEnabled = false;
35 test( "siblings without ignore parent are enhanced", function() {
36 $.mobile.ignoreContentEnabled = true;
38 $.mobile.collapsible.prototype.enhanceWithin( $("#many-ignored") );
40 ok( !$( "#many-ignored-collapsible" ).hasClass( "ui-collapsible" ), "sibling ignored element doesn't have ui-collapsible" );
41 ok( $( "#many-enhanced-collapsible" ).hasClass( "ui-collapsible" ), "sibling unignored elements are enahanced" );
43 $.mobile.ignoreContentEnabled = false;