]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget Factory: Make $.widget return the constructor. Fixes #9467 - Widget factory...
authorAlexander Schmitz <arschmitz@gmail.com>
Wed, 31 Jul 2013 19:56:04 +0000 (15:56 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 31 Jul 2013 20:52:21 +0000 (16:52 -0400)
tests/unit/widget/widget_core.js
ui/jquery.ui.widget.js

index 3268b756d26c365d01b57848bf1d2e59854e7149..aff07cc358cb282de64619076690c6f7c0746087 100644 (file)
@@ -615,12 +615,13 @@ test( ".disable()", function() {
 });
 
 test( ".widget() - base", function() {
-       expect( 1 );
-       $.widget( "ui.testWidget", {
+       expect( 2 );
+       var constructor = $.widget( "ui.testWidget", {
                _create: function() {}
        });
        var div = $( "<div>" ).testWidget();
        deepEqual( div[0], div.testWidget( "widget" )[0]);
+       deepEqual( constructor, $.ui.testWidget, "$.widget returns the constructor" );
 });
 
 test( ".widget() - overriden", function() {
index 93daaf1ca0856d6288073d24cbe6767eb68ec227..885e2019f4016ac225c1e296add6eea5fe339a84 100644 (file)
@@ -134,6 +134,8 @@ $.widget = function( name, base, prototype ) {
        }
 
        $.widget.bridge( name, constructor );
+
+       return constructor;
 };
 
 $.widget.extend = function( target ) {