alter pageinit test to validate that child widgets are in fact enhanced when the event is fired. covers the previous tests case

This commit is contained in:
John Bender 2011-09-16 10:04:16 -07:00
parent 095d731398
commit c61354447c
2 changed files with 9 additions and 4 deletions

View file

@ -33,6 +33,7 @@
</div>
<div id="foo" data-role="page">
<input type="range" id="foo-slider" name="foo-slider" value="" />
</div>
</body>

View file

@ -2,15 +2,19 @@
* mobile widget unit tests
*/
(function($){
var initFired = false;
var widgetInitialized = false;
module( 'jquery.mobile.widget.js' );
$( "#foo" ).live( 'pageinit', function(){
initFired = true;
// ordering sensitive here, the value has to be set after the call
// so that if the widget factory says that its not yet initialized,
// which is an exception, the value won't be set
$( "#foo-slider" ).slider( 'refresh' );
widgetInitialized = true;
});
test( "widget init event is fired after markup enhancement has taken place", function() {
ok( initFired );
test( "page is enhanced before init is fired", function() {
ok( widgetInitialized );
});
})( jQuery );