mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-30 02:44:44 +00:00
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:
parent
095d731398
commit
c61354447c
2 changed files with 9 additions and 4 deletions
|
|
@ -33,6 +33,7 @@
|
|||
</div>
|
||||
|
||||
<div id="foo" data-role="page">
|
||||
<input type="range" id="foo-slider" name="foo-slider" value="" />
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
Loading…
Reference in a new issue