Browse files

alter pageinit test to validate that child widgets are in fact enhanc…

…ed when the event is fired. covers the previous tests case
  • Loading branch information...
1 parent 095d731 commit c61354447c1e2045cbac8e0753efad2ead7939af @johnbender johnbender committed Sep 16, 2011
Showing with 9 additions and 4 deletions.
  1. +1 −0 tests/unit/widget/index.html
  2. +8 −4 tests/unit/widget/widget_init.js
View
1 tests/unit/widget/index.html
@@ -33,6 +33,7 @@ <h2 id="qunit-userAgent"></h2>
</div>
<div id="foo" data-role="page">
+ <input type="range" id="foo-slider" name="foo-slider" value="" />
</div>
</body>
View
12 tests/unit/widget/widget_init.js
@@ -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 );

0 comments on commit c613544

Please sign in to comment.