diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-08-12 22:10:31 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-08-12 22:10:31 -0400 |
commit | 4587f2de68a884bc6d749728bfd6a555efb14b54 (patch) | |
tree | 559070b8949b54c589c2ed7a49fc1ef5b5962d03 /tests/unit/widget | |
parent | 1729e3a32e4c2e4b922ce799f98ef0a4b1cd360e (diff) | |
download | jquery-ui-4587f2de68a884bc6d749728bfd6a555efb14b54.tar.gz jquery-ui-4587f2de68a884bc6d749728bfd6a555efb14b54.zip |
Widget: Use this.widget() for event delegation.
Diffstat (limited to 'tests/unit/widget')
-rw-r--r-- | tests/unit/widget/widget_core.js | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 8cacdd47d..41ae8ffb4 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -673,23 +673,31 @@ test( "_bind() with delegate", function() { this.element = { bind: function( event, handler ) { equal( event, "click.testWidget" ); - ok( $.isFunction(handler) ); - }, - delegate: function( selector, event, handler ) { - equal( selector, "a" ); - equal( event, "click.testWidget" ); - ok( $.isFunction(handler) ); + ok( $.isFunction(handler) ); }, trigger: $.noop }; + this.widget = function() { + return { + delegate: function( selector, event, handler ) { + equal( selector, "a" ); + equal( event, "click.testWidget" ); + ok( $.isFunction(handler) ); + } + }; + }; this._bind({ "click": "handler", - "click a": "handler", + "click a": "handler" }); - this.element.delegate = function( selector, event, handler ) { - equal( selector, "form fieldset > input" ); - equal( event, "change.testWidget" ); - ok( $.isFunction(handler) ); + this.widget = function() { + return { + delegate: function( selector, event, handler ) { + equal( selector, "form fieldset > input" ); + equal( event, "change.testWidget" ); + ok( $.isFunction(handler) ); + } + }; }; this._bind({ "change form fieldset > input": "handler" |