]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Move call to _focusTabbable and triggering of open and focus events into... 880/head
authorKris Borchers <kris.borchers@gmail.com>
Wed, 30 Jan 2013 18:30:37 +0000 (12:30 -0600)
committerKris Borchers <kris.borchers@gmail.com>
Wed, 30 Jan 2013 18:30:37 +0000 (12:30 -0600)
tests/unit/dialog/dialog.html
tests/unit/dialog/dialog_options.js
ui/jquery.ui.dialog.js

index 57017b1b92590fe5df401d74b2aa42f167008bbf..7943b425b995fa9dda6a0a158f63668004d386ab 100644 (file)
@@ -24,7 +24,9 @@
                        "ui/jquery.ui.resizable.js",
                        "ui/jquery.ui.button.js",
                        "ui/jquery.ui.effect.js",
+                       "ui/jquery.ui.effect-blind.js",
                        "ui/jquery.ui.effect-clip.js",
+                       "ui/jquery.ui.effect-explode.js",
                        "ui/jquery.ui.dialog.js"
                ]
        });
index 5f043430835619d767a170823359ccbb3790410c..ecb7e5dd23c440a1632f550b8bfe495bb6eec4cc 100644 (file)
@@ -531,4 +531,44 @@ test("#4826: setting resizable false toggles resizable on dialog", function() {
 
 });
 
+asyncTest( "#8051 - 'Explode' dialog animation causes crash in IE 6, 7 and 8", function() {
+       expect( 1 );
+       var el = $( "<div></div>" ).dialog({
+               show: "explode",
+               focus: function() {
+                       ok( true, "dialog opened with animation" );
+                       el.remove();
+                       start();
+               }
+       });
+});
+
+asyncTest( "#4421 - Focus lost from dialog which uses show-effect", function() {
+       expect( 1 );
+       var el = $( "<div></div>" ).dialog({
+               show: "blind",
+               focus: function() {
+                       equal( el.dialog( "widget" ).find( ":focus" ).length, 1, "dialog maintains focus" );
+                       el.remove();
+                       start();
+               }
+       });
+});
+
+asyncTest( "Open followed by close during show effect", function() {
+       expect( 1 );
+       var el = $( "<div></div>" ).dialog({
+               show: "blind",
+               close: function() {
+                       ok( true, "dialog closed properly during animation" );
+                       el.remove();
+                       start();
+               }
+       });
+
+       setTimeout( function() {
+               el.dialog("close");
+       }, 100 );
+});
+
 })(jQuery);
index ec4032ff3b5e208a66b0f439e855b58dc15a19c3..77bf68dd1d59fb65f8710208d24849ee58a4004c 100644 (file)
@@ -207,6 +207,7 @@ $.widget( "ui.dialog", {
        },
 
        open: function() {
+               var that = this;
                if ( this._isOpen ) {
                        if ( this._moveToTop() ) {
                                this._focusTabbable();
@@ -220,13 +221,13 @@ $.widget( "ui.dialog", {
                this._position();
                this._createOverlay();
                this._moveToTop( null, true );
-               this._show( this.uiDialog, this.options.show );
-
-               this._focusTabbable();
+               this._show( this.uiDialog, this.options.show, function() {
+                       that._focusTabbable();
+                       that._trigger("focus");
+               });
 
                this._isOpen = true;
                this._trigger("open");
-               this._trigger("focus");
        },
 
        _focusTabbable: function() {