aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-02-03 16:37:17 -0500
committerScott González <scott.gonzalez@gmail.com>2011-02-03 16:37:17 -0500
commitee88a562433e75a0dd500ed7c71376d279eaacdf (patch)
treeadd7d9669cf4d41a04005b04c312749b867d5b38 /tests
parented4903370090c5e81a5be7a9e23f351fc1b062a6 (diff)
downloadjquery-ui-ee88a562433e75a0dd500ed7c71376d279eaacdf.tar.gz
jquery-ui-ee88a562433e75a0dd500ed7c71376d279eaacdf.zip
Widget: Added ability to use $.widget() to create extensions. Fixes #6937 - Widget: Allow redefining a widget to create extensions.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/widget/widget_core.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 6f4930621..186c407ed 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -821,4 +821,25 @@ test( "auto-destroy - .detach()", function() {
$( "#widget" ).testWidget().detach();
});
+test( "redefine", function() {
+ expect( 4 );
+ $.widget( "ui.testWidget", {
+ method: function( str ) {
+ strictEqual( this, instance, "original invoked with correct this" );
+ equal( str, "bar", "original invoked with correct parameter" );
+ }
+ });
+ var ctor = $.ui.testWidget;
+ $.widget( "ui.testWidget", $.ui.testWidget, {
+ method: function( str ) {
+ equal( str, "foo", "new invoked with correct parameter" );
+ this._super( "method", "bar" );
+ }
+ });
+
+ var instance = new $.ui.testWidget();
+ instance.method( "foo" );
+ equal( $.ui.testWidget, ctor, "constructor did not change" );
+});
+
}( jQuery ) );