Skip to content

Commit c0ab710

Browse files
arschmitzscottgonzalez
authored andcommitted
Widget Factory: Make $.widget return the constructor. Fixes #9467 - Widget factory: Return the constructor from $.widget().
1 parent c4c90f3 commit c0ab710

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tests/unit/widget/widget_core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,12 +615,13 @@ test( ".disable()", function() {
615615
});
616616

617617
test( ".widget() - base", function() {
618-
expect( 1 );
619-
$.widget( "ui.testWidget", {
618+
expect( 2 );
619+
var constructor = $.widget( "ui.testWidget", {
620620
_create: function() {}
621621
});
622622
var div = $( "<div>" ).testWidget();
623623
deepEqual( div[0], div.testWidget( "widget" )[0]);
624+
deepEqual( constructor, $.ui.testWidget, "$.widget returns the constructor" );
624625
});
625626

626627
test( ".widget() - overriden", function() {

ui/jquery.ui.widget.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ $.widget = function( name, base, prototype ) {
134134
}
135135

136136
$.widget.bridge( name, constructor );
137+
138+
return constructor;
137139
};
138140

139141
$.widget.extend = function( target ) {

0 commit comments

Comments
 (0)