Skip to content

Commit

Permalink
Widget: Use existing widgetEventPrefix when extending. Fixes #8724 - …
Browse files Browse the repository at this point in the history
…widgetEventPrefix is lost when extending existing widget.
  • Loading branch information
scottgonzalez committed Oct 24, 2012
1 parent ba752cf commit 848ab48
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions tests/unit/widget/widget_core.js
Expand Up @@ -1240,6 +1240,21 @@ test( "redefine deep prototype chain", function() {
delete $.ui.testWidget2;
});

test( "redefine - widgetEventPrefix", function() {
expect( 2 );

$.widget( "ui.testWidget", {
widgetEventPrefix: "test"
});
equal( $.ui.testWidget.prototype.widgetEventPrefix, "test",
"cusotm prefix in original" );

$.widget( "ui.testWidget", $.ui.testWidget, {} );
equal( $.ui.testWidget.prototype.widgetEventPrefix, "test",
"cusotm prefix in extension" );

});

asyncTest( "_delay", function() {
expect( 6 );
var order = 0,
Expand Down
2 changes: 1 addition & 1 deletion ui/jquery.ui.widget.js
Expand Up @@ -101,7 +101,7 @@ $.widget = function( name, base, prototype ) {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: name
widgetEventPrefix: basePrototype.widgetEventPrefix || name
}, prototype, {
constructor: constructor,
namespace: namespace,
Expand Down

0 comments on commit 848ab48

Please sign in to comment.