]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Added _getCreateEventData(). Fixes #8045 - Widget: Ability to provide event...
authorScott González <scott.gonzalez@gmail.com>
Sat, 21 Jan 2012 13:45:41 +0000 (08:45 -0500)
committerScott González <scott.gonzalez@gmail.com>
Sat, 21 Jan 2012 13:45:41 +0000 (08:45 -0500)
tests/unit/widget/widget_core.js
ui/jquery.ui.widget.js

index 2e55ad703186c41fdccb0557044d4f024f1f723b..df83abe91b4543d9b0d5a8f482c5e1b03605b77b 100644 (file)
@@ -261,6 +261,21 @@ test( "._getCreateOptions()", function() {
        $( "<div>" ).testWidget({ option2: "value2" });
 });
 
+test( "._getCreateEventData()", function() {
+       expect( 1 );
+       var data = { foo: "bar" };
+       $.widget( "ui.testWidget", {
+               _getCreateEventData: function() {
+                       return data;
+               }
+       });
+       $( "<div>" ).testWidget({
+               create: function( event, ui ) {
+                       strictEqual( ui, data, "event data" );
+               }
+       });
+});
+
 test( "re-init", function() {
        var div = $( "<div>" ),
                actions = [];
index 5c8560bfd33d8472f758ff7caebac5cfd919b121..ad03e6f44ac4ee5460cc1990961f0e52c34f2e74 100644 (file)
@@ -204,10 +204,11 @@ $.Widget.prototype = {
                }
 
                this._create();
-               this._trigger( "create" );
+               this._trigger( "create", null, this._getCreateEventData() );
                this._init();
        },
        _getCreateOptions: $.noop,
+       _getCreateEventData: $.noop,
        _create: $.noop,
        _init: $.noop,