Skip to content

Commit

Permalink
Widget: Added _getCreateEventData(). Fixes #8045 - Widget: Ability to…
Browse files Browse the repository at this point in the history
… provide event data for create event.
  • Loading branch information
scottgonzalez committed Jan 21, 2012
1 parent 0cf6bc0 commit da89fcb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions tests/unit/widget/widget_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
3 changes: 2 additions & 1 deletion ui/jquery.ui.widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down

0 comments on commit da89fcb

Please sign in to comment.