aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael DellaNoce <mdellanoce@mailtrust.com>2011-02-01 06:57:48 -0500
committerScott González <scott.gonzalez@gmail.com>2011-02-01 06:57:48 -0500
commitb3fcf174716203013e9844f1aee3216f971fcd43 (patch)
tree32aeb79ac8b9de60ddfc9bf6b731c0270d00f353 /tests
parentcb8f5b7f2679ab5473229cac432f28c72521048c (diff)
downloadjquery-ui-b3fcf174716203013e9844f1aee3216f971fcd43.tar.gz
jquery-ui-b3fcf174716203013e9844f1aee3216f971fcd43.zip
Widget: Modified _trigger to invoke callbacks with apply so that handlers are invoked the same way .trigger() invokes them. Fixes #6795 - Widget: _trigger passes array arguments to handlers inconsistently.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/widget/widget_tickets.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/unit/widget/widget_tickets.js b/tests/unit/widget/widget_tickets.js
index 0267c8ff4..9c0bddf03 100644
--- a/tests/unit/widget/widget_tickets.js
+++ b/tests/unit/widget/widget_tickets.js
@@ -40,4 +40,52 @@ test( "#5830 - Widget: Using inheritance overwrites the base classes options", f
delete $.ui.testWidgetExtension;
});
+test( "#6795 - Widget: handle array arguments to _trigger consistently", function() {
+ expect( 4 );
+
+ $.widget( "ui.testWidget", {
+ _create: function() {},
+ testEvent: function() {
+ var ui = {
+ foo: "bar",
+ baz: {
+ qux: 5,
+ quux: 20
+ }
+ };
+ var extra = {
+ bar: 5
+ };
+ this._trigger( "foo", null, [ ui, extra ] );
+ }
+ });
+ $( "#widget" ).bind( "testwidgetfoo", function( event, ui, extra ) {
+ same( ui, {
+ foo: "bar",
+ baz: {
+ qux: 5,
+ quux: 20
+ }
+ }, "event: ui hash passed" );
+ same( extra, {
+ bar: 5
+ }, "event: extra argument passed" );
+ });
+ $( "#widget" ).testWidget({
+ foo: function( event, ui, extra ) {
+ same( ui, {
+ foo: "bar",
+ baz: {
+ qux: 5,
+ quux: 20
+ }
+ }, "callback: ui hash passed" );
+ same( extra, {
+ bar: 5
+ }, "callback: extra argument passed" );
+ }
+ })
+ .testWidget( "testEvent" );
+});
+
}( jQuery ) );