]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Set the _isOpen flag before triggering the open event. Fixes #6012 - Dialog...
authorScott González <scott.gonzalez@gmail.com>
Thu, 2 Sep 2010 12:35:40 +0000 (08:35 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 2 Sep 2010 12:35:40 +0000 (08:35 -0400)
tests/unit/dialog/dialog_events.js
ui/jquery.ui.dialog.js

index e2b7bd9eedaf1e925fc8f5a0d43f973b8fbffb6c..8c7657dfd091043bc1c12e09809859966864fe4e 100644 (file)
@@ -6,11 +6,12 @@
 module("dialog: events");
 
 test("open", function() {
-       expect(11);
+       expect(13);
 
        el = $("<div></div>");
        el.dialog({
                open: function(ev, ui) {
+                       ok(el.data("dialog")._isOpen, "interal _isOpen flag is set");
                        ok(true, 'autoOpen: true fires open callback');
                        equals(this, el[0], "context of callback");
                        equals(ev.type, 'dialogopen', 'event type in callback');
@@ -29,6 +30,7 @@ test("open", function() {
                        same(ui, {}, 'ui hash in callback');
                }
        }).bind('dialogopen', function(ev, ui) {
+               ok(el.data("dialog")._isOpen, "interal _isOpen flag is set");
                ok(true, 'dialog("open") fires open event');
                equals(this, el[0], 'context of event');
                same(ui, {}, 'ui hash in event');
index 17300b178b870d6c995d241aa727756a8ec32372..a1c911b8e903631fdfea841469544f74178a6842 100644 (file)
@@ -329,8 +329,8 @@ $.widget("ui.dialog", {
                        uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
                                uiDialog.get()))).eq(0).focus();
 
-               self._trigger('open');
                self._isOpen = true;
+               self._trigger('open');
 
                return self;
        },