@@ -27,14 +27,14 @@ test( "widget creation", function() {
2727} ) ;
2828
2929test ( "jQuery usage" , function ( ) {
30- expect ( 10 ) ;
30+ expect ( 11 ) ;
3131
32- var shouldInit = false ;
32+ var shouldCreate = false ;
3333
3434 $ . widget ( "ui.testWidget" , {
3535 getterSetterVal : 5 ,
3636 _create : function ( ) {
37- ok ( shouldInit , "init called on instantiation" ) ;
37+ ok ( shouldCreate , "create called on instantiation" ) ;
3838 } ,
3939 methodWithParams : function ( param1 , param2 ) {
4040 ok ( true , "method called via .pluginName(methodName)" ) ;
@@ -54,9 +54,13 @@ test( "jQuery usage", function() {
5454 }
5555 } ) ;
5656
57- shouldInit = true ;
58- var elem = $ ( "<div></div>" ) . testWidget ( ) ;
59- shouldInit = false ;
57+ shouldCreate = true ;
58+ var elem = $ ( "<div></div>" )
59+ . bind ( "testwidgetcreate" , function ( ) {
60+ ok ( shouldCreate , "create event triggered on instantiation" ) ;
61+ } )
62+ . testWidget ( ) ;
63+ shouldCreate = false ;
6064
6165 var instance = elem . data ( "testWidget" ) ;
6266 equals ( typeof instance , "object" , "instance stored in .data(pluginName)" ) ;
@@ -74,12 +78,12 @@ test( "jQuery usage", function() {
7478test ( "direct usage" , function ( ) {
7579 expect ( 9 ) ;
7680
77- var shouldInit = false ;
81+ var shouldCreate = false ;
7882
7983 $ . widget ( "ui.testWidget" , {
8084 getterSetterVal : 5 ,
8185 _create : function ( ) {
82- ok ( shouldInit , "init called on instantiation" ) ;
86+ ok ( shouldCreate , "create called on instantiation" ) ;
8387 } ,
8488 methodWithParams : function ( param1 , param2 ) {
8589 ok ( true , "method called dirctly" ) ;
@@ -99,9 +103,9 @@ test( "direct usage", function() {
99103
100104 var elem = $ ( "<div></div>" ) [ 0 ] ;
101105
102- shouldInit = true ;
106+ shouldCreate = true ;
103107 var instance = new $ . ui . testWidget ( { } , elem ) ;
104- shouldInit = false ;
108+ shouldCreate = false ;
105109
106110 equals ( $ ( elem ) . data ( "testWidget" ) , instance ,
107111 "instance stored in .data(pluginName)" ) ;
0 commit comments