Skip to content

Commit 35dc930

Browse files
petersendiditscottgonzalez
authored andcommitted
Dialog: Use _hide() to make sure close event gets triggered. Fixes #8684 - jQuery dialog with hide options does not trigger close event.
1 parent dda1925 commit 35dc930

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

tests/unit/dialog/dialog_events.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ test("resizeStop", function() {
195195
el.remove();
196196
});
197197

198-
test("close", function() {
199-
expect(7);
198+
asyncTest("close", function() {
199+
expect(14);
200200

201201
el = $('<div></div>').dialog({
202202
close: function(ev, ui) {
@@ -212,6 +212,23 @@ test("close", function() {
212212
});
213213
el.dialog('close');
214214
el.remove();
215+
216+
// Close event with an effect
217+
el = $('<div></div>').dialog({
218+
hide: 10,
219+
close: function(ev, ui) {
220+
ok(true, '.dialog("close") fires close callback');
221+
equal(this, el[0], "context of callback");
222+
equal(ev.type, 'dialogclose', 'event type in callback');
223+
deepEqual(ui, {}, 'ui hash in callback');
224+
start();
225+
}
226+
}).bind('dialogclose', function(ev, ui) {
227+
ok(true, '.dialog("close") fires dialogclose event');
228+
equal(this, el[0], 'context of event');
229+
deepEqual(ui, {}, 'ui hash in event');
230+
});
231+
el.dialog('close');
215232
});
216233

217234
test("beforeClose", function() {

ui/jquery.ui.dialog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ $.widget("ui.dialog", {
251251
}
252252

253253
if ( this.options.hide ) {
254-
this.uiDialog.hide( this.options.hide, function() {
254+
this._hide( this.uiDialog, this.options.hide, function() {
255255
that._trigger( "close", event );
256256
});
257257
} else {

0 commit comments

Comments
 (0)