aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 {