aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-09-29 17:36:45 -0700
committerScott González <scott.gonzalez@gmail.com>2010-09-29 17:36:45 -0700
commita2ddfd51072952969792cd3b503e573ea8f18d30 (patch)
treecd7e8a3307f3665fea9966d2124536facc8d35e2 /tests/unit
parent99b71a51c8cec70ab7ebccf61d6d388ef114d92d (diff)
downloadjquery-ui-a2ddfd51072952969792cd3b503e573ea8f18d30.tar.gz
jquery-ui-a2ddfd51072952969792cd3b503e573ea8f18d30.zip
Widget: Added create event. Fixes #6126 - Widget: Add create event.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/widget/widget_core.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 76d6543c2..364838e3f 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -27,14 +27,14 @@ test( "widget creation", function() {
});
test( "jQuery usage", function() {
- expect( 10 );
+ expect( 11 );
- var shouldInit = false;
+ var shouldCreate = false;
$.widget( "ui.testWidget", {
getterSetterVal: 5,
_create: function() {
- ok( shouldInit, "init called on instantiation" );
+ ok( shouldCreate, "create called on instantiation" );
},
methodWithParams: function( param1, param2 ) {
ok( true, "method called via .pluginName(methodName)" );
@@ -54,9 +54,13 @@ test( "jQuery usage", function() {
}
});
- shouldInit = true;
- var elem = $( "<div></div>" ).testWidget();
- shouldInit = false;
+ shouldCreate = true;
+ var elem = $( "<div></div>" )
+ .bind( "testwidgetcreate", function() {
+ ok( shouldCreate, "create event triggered on instantiation" );
+ })
+ .testWidget();
+ shouldCreate = false;
var instance = elem.data( "testWidget" );
equals( typeof instance, "object", "instance stored in .data(pluginName)" );
@@ -74,12 +78,12 @@ test( "jQuery usage", function() {
test( "direct usage", function() {
expect( 9 );
- var shouldInit = false;
+ var shouldCreate = false;
$.widget( "ui.testWidget", {
getterSetterVal: 5,
_create: function() {
- ok( shouldInit, "init called on instantiation" );
+ ok( shouldCreate, "create called on instantiation" );
},
methodWithParams: function( param1, param2 ) {
ok( true, "method called dirctly" );
@@ -99,9 +103,9 @@ test( "direct usage", function() {
var elem = $( "<div></div>" )[ 0 ];
- shouldInit = true;
+ shouldCreate = true;
var instance = new $.ui.testWidget( {}, elem );
- shouldInit = false;
+ shouldCreate = false;
equals( $( elem ).data( "testWidget" ), instance,
"instance stored in .data(pluginName)" );