aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2010-07-30 14:26:58 +0200
committerjzaefferer <joern.zaefferer@gmail.com>2010-07-30 14:26:58 +0200
commitea58cd5ac0d852a9c7d7ceadbcbb74006cf9052d (patch)
tree35cff2c8f0505cf9b5430b33df0ff7ab5c85dc59
parentb3940d2f78dfcc37792ceb97e5659b78f156794c (diff)
downloadjquery-ui-ea58cd5ac0d852a9c7d7ceadbcbb74006cf9052d.tar.gz
jquery-ui-ea58cd5ac0d852a9c7d7ceadbcbb74006cf9052d.zip
Use pushStack in widget method. Fixes #5732 - make the widget method maintain the stack
-rw-r--r--tests/unit/autocomplete/autocomplete_methods.js10
-rw-r--r--tests/unit/button/button_methods.js14
-rw-r--r--tests/unit/dialog/dialog_methods.js6
-rw-r--r--tests/unit/widget/widget_core.js9
-rw-r--r--ui/jquery.ui.autocomplete.js2
-rw-r--r--ui/jquery.ui.button.js2
-rw-r--r--ui/jquery.ui.dialog.js2
-rw-r--r--ui/jquery.ui.widget.js2
8 files changed, 39 insertions, 8 deletions
diff --git a/tests/unit/autocomplete/autocomplete_methods.js b/tests/unit/autocomplete/autocomplete_methods.js
index 05a7d6e14..a009a83f5 100644
--- a/tests/unit/autocomplete/autocomplete_methods.js
+++ b/tests/unit/autocomplete/autocomplete_methods.js
@@ -38,6 +38,14 @@ test("search", function() {
same( $(".ui-menu .ui-menu-item").length, 2, "only java and javascript for 'ja'" );
$("#autocomplete").autocomplete("destroy");
-})
+});
+
+test("widget", function() {
+ var ac = $("#autocomplete").autocomplete({
+ source: data
+ });
+ same(ac.autocomplete("widget")[0], $(":ui-menu")[0]);
+ same(ac.autocomplete("widget").end()[0], ac[0]);
+});
})(jQuery);
diff --git a/tests/unit/button/button_methods.js b/tests/unit/button/button_methods.js
index a83a73ba4..5197bc40c 100644
--- a/tests/unit/button/button_methods.js
+++ b/tests/unit/button/button_methods.js
@@ -16,4 +16,18 @@ test("destroy", function() {
equal( afterHtml, beforeHtml );
});
+test("widget", function() {
+ var submit = $("#submit").button();
+ same(submit.button("widget")[0], submit[0]);
+ same(submit.button("widget").end()[0], submit[0]);
+
+ var check = $("#check").button();
+ same(check.button("widget")[0], check.next("label")[0]);
+ same(check.button("widget").end()[0], check[0]);
+
+ var radio = $("#radio01").button();
+ same(radio.button("widget")[0], radio.next("label")[0]);
+ same(radio.button("widget").end()[0], radio[0]);
+});
+
})(jQuery);
diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js
index 93d1b25db..e4b77aa0b 100644
--- a/tests/unit/dialog/dialog_methods.js
+++ b/tests/unit/dialog/dialog_methods.js
@@ -130,4 +130,10 @@ test("open", function() {
ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog visible after open method called');
});
+test("widget", function() {
+ var dialog = $('<div></div>').dialog();
+ same(dialog.dialog("widget")[0], dialog.parent()[0]);
+ same(dialog.dialog("widget").end()[0], dialog[0]);
+});
+
})(jQuery);
diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js
index 3c870f1fe..52c91d51e 100644
--- a/tests/unit/widget/widget_core.js
+++ b/tests/unit/widget/widget_core.js
@@ -151,7 +151,8 @@ test(".widget() - base", function() {
_create: function() {}
});
var div = $("<div></div>").testWidget()
- same(div[0], div.testWidget("widget")[0]);
+ same(div.testWidget("widget")[0], div[0]);
+ same(div.testWidget("widget").end()[0], div[0]);
});
test(".widget() - overriden", function() {
@@ -159,10 +160,12 @@ test(".widget() - overriden", function() {
$.widget("ui.testWidget", {
_create: function() {},
widget: function() {
- return wrapper;
+ return this.element.pushStack(wrapper.get());
}
});
- same(wrapper[0], $("<div></div>").testWidget().testWidget("widget")[0]);
+ var div = $("<div></div>").testWidget();
+ same(div.testWidget("widget")[0], wrapper[0]);
+ same(div.testWidget("widget").end()[0], div[0]);
});
})(jQuery);
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 855037824..e93818d53 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -311,7 +311,7 @@ $.widget( "ui.autocomplete", {
},
widget: function() {
- return this.menu.element;
+ return this.element.pushStack(this.menu.element.get());
}
});
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index b2fab4d24..54e099a0a 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -210,7 +210,7 @@ $.widget( "ui.button", {
},
widget: function() {
- return this.buttonElement;
+ return this.element.pushStack(this.buttonElement.get());
},
destroy: function() {
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index df11e2190..0122ce905 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -207,7 +207,7 @@ $.widget("ui.dialog", {
},
widget: function() {
- return this.uiDialog;
+ return this.element.pushStack(this.uiDialog.get());
},
close: function(event) {
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index e21287ae0..b5e10ba0f 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -160,7 +160,7 @@ $.Widget.prototype = {
},
widget: function() {
- return this.element;
+ return this.element.pushStack(this.element.get());
},
option: function( key, value ) {