mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Dialog: Use _hide() to make sure close event gets triggered. Fixes #8684 - jQuery dialog with hide options does not trigger close event.
This commit is contained in:
parent
dda1925d0f
commit
35dc9307fc
@ -195,8 +195,8 @@ test("resizeStop", function() {
|
|||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("close", function() {
|
asyncTest("close", function() {
|
||||||
expect(7);
|
expect(14);
|
||||||
|
|
||||||
el = $('<div></div>').dialog({
|
el = $('<div></div>').dialog({
|
||||||
close: function(ev, ui) {
|
close: function(ev, ui) {
|
||||||
@ -212,6 +212,23 @@ test("close", function() {
|
|||||||
});
|
});
|
||||||
el.dialog('close');
|
el.dialog('close');
|
||||||
el.remove();
|
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() {
|
test("beforeClose", function() {
|
||||||
|
2
ui/jquery.ui.dialog.js
vendored
2
ui/jquery.ui.dialog.js
vendored
@ -251,7 +251,7 @@ $.widget("ui.dialog", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( this.options.hide ) {
|
if ( this.options.hide ) {
|
||||||
this.uiDialog.hide( this.options.hide, function() {
|
this._hide( this.uiDialog, this.options.hide, function() {
|
||||||
that._trigger( "close", event );
|
that._trigger( "close", event );
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user