aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Petersen <public@petersendidit.com>2012-10-17 09:28:51 -0400
committerScott González <scott.gonzalez@gmail.com>2012-10-17 20:28:27 -0400
commit35dc9307fc2ce5d2016e8848fdc578829867f97e (patch)
treef790ab2b80820832de325a70899b96383c367fe4
parentdda1925d0f8d19b4baffa20259674dcef85e8bab (diff)
downloadjquery-ui-35dc9307fc2ce5d2016e8848fdc578829867f97e.tar.gz
jquery-ui-35dc9307fc2ce5d2016e8848fdc578829867f97e.zip
Dialog: Use _hide() to make sure close event gets triggered. Fixes #8684 - jQuery dialog with hide options does not trigger close event.
-rw-r--r--tests/unit/dialog/dialog_events.js21
-rw-r--r--ui/jquery.ui.dialog.js2
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 = $('<div></div>').dialog({
close: function(ev, ui) {
@@ -212,6 +212,23 @@ test("close", function() {
});
el.dialog('close');
el.remove();
+
+ // Close event with an effect
+ el = $('<div></div>').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 {