From 35dc9307fc2ce5d2016e8848fdc578829867f97e Mon Sep 17 00:00:00 2001 From: David Petersen Date: Wed, 17 Oct 2012 09:28:51 -0400 Subject: [PATCH] Dialog: Use _hide() to make sure close event gets triggered. Fixes #8684 - jQuery dialog with hide options does not trigger close event. --- tests/unit/dialog/dialog_events.js | 21 +++++++++++++++++++-- ui/jquery.ui.dialog.js | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 85afa5a3b..515bebdc1 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -195,8 +195,8 @@ test("resizeStop", function() { el.remove(); }); -test("close", function() { - expect(7); +asyncTest("close", function() { + expect(14); el = $('
').dialog({ close: function(ev, ui) { @@ -212,6 +212,23 @@ test("close", function() { }); el.dialog('close'); el.remove(); + + // Close event with an effect + el = $('
').dialog({ + hide: 10, + close: function(ev, ui) { + ok(true, '.dialog("close") fires close callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); + start(); + } + }).bind('dialogclose', function(ev, ui) { + ok(true, '.dialog("close") fires dialogclose event'); + equal(this, el[0], 'context of event'); + deepEqual(ui, {}, 'ui hash in event'); + }); + el.dialog('close'); }); test("beforeClose", function() { diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index d83059ade..e234464ad 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -251,7 +251,7 @@ $.widget("ui.dialog", { } if ( this.options.hide ) { - this.uiDialog.hide( this.options.hide, function() { + this._hide( this.uiDialog, this.options.hide, function() { that._trigger( "close", event ); }); } else { -- 2.39.5