aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/widget
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-06-19 14:59:18 +0200
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-06-19 14:59:18 +0200
commit8b14b35dc72afce16b544b011a04d1e5ea1b7344 (patch)
tree9e2cb2a8a0162dc382686b68f71318527f0cfbcd /tests/unit/widget
parentaa7f8195f8c288dbefcb92064b68cb28064ac64c (diff)
downloadjquery-ui-8b14b35dc72afce16b544b011a04d1e5ea1b7344.tar.gz
jquery-ui-8b14b35dc72afce16b544b011a04d1e5ea1b7344.zip
Widget delegation: Fix impl and add basisc test
Diffstat (limited to 'tests/unit/widget')
-rw-r--r--tests/unit/widget/widget_core.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index bb21b74ea..c73f7284c 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -666,6 +666,40 @@ test( "._bind() to descendent", function() {
.trigger( "keydown" );
});
+test( "_bind() with delegate", function() {
+ expect( 8 );
+ $.widget( "ui.testWidget", {
+ _create: function() {
+ var that = this;
+ 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) );
+ },
+ trigger: $.noop
+ }
+ this._bind({
+ "click": "handler",
+ "click a": "handler",
+ });
+ this.element.delegate = function( selector, event, handler ) {
+ equal( selector, "form fieldset > input" );
+ equal( event, "change.testWidget" );
+ ok( $.isFunction(handler) );
+ };
+ this._bind({
+ "change form fieldset > input": "handler"
+ });
+ }
+ });
+ $.ui.testWidget();
+})
+
test( "._hoverable()", function() {
$.widget( "ui.testWidget", {
_create: function() {