]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Use _hide() to make sure close event gets triggered. Fixes #8684 - jQuery...
authorDavid Petersen <public@petersendidit.com>
Wed, 17 Oct 2012 13:28:51 +0000 (09:28 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 18 Oct 2012 00:28:27 +0000 (20:28 -0400)
tests/unit/dialog/dialog_events.js
ui/jquery.ui.dialog.js

index 85afa5a3b996d46a18593090237d0ac2d03c93fe..515bebdc19a88ba71a0679694a9cb95cac10e3c4 100644 (file)
@@ -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() {
index d83059ade001d112af25dfad5e77885760a5d7ac..e234464ad94726d48940f8a48e4bf265aa78d0df 100644 (file)
@@ -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 {