File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,9 @@ test("init", function() {
34
34
} ) ;
35
35
36
36
test ( "destroy" , function ( ) {
37
- expect ( 6 ) ;
37
+ expect ( 7 ) ;
38
38
39
- // Dialogs are expected to be hidden on destroy, so make sure they're hidden
40
- // before the test
41
39
$ ( "#dialog1, #form-dialog" ) . hide ( ) ;
42
-
43
40
domEqual ( "#dialog1" , function ( ) {
44
41
var dialog = $ ( "#dialog1" ) . dialog ( ) . dialog ( "destroy" ) ;
45
42
equal ( dialog . parent ( ) [ 0 ] , $ ( "#qunit-fixture" ) [ 0 ] ) ;
@@ -50,6 +47,16 @@ test("destroy", function() {
50
47
equal ( dialog . parent ( ) [ 0 ] , $ ( "#qunit-fixture" ) [ 0 ] ) ;
51
48
equal ( dialog . index ( ) , 2 ) ;
52
49
} ) ;
50
+
51
+ // Ensure dimensions are restored (#8119)
52
+ $ ( "#dialog1" ) . show ( ) . css ( {
53
+ width : "400px" ,
54
+ minHeight : "100px" ,
55
+ height : "200px"
56
+ } ) ;
57
+ domEqual ( "#dialog1" , function ( ) {
58
+ $ ( "#dialog1" ) . dialog ( ) . dialog ( "destroy" ) ;
59
+ } ) ;
53
60
} ) ;
54
61
55
62
test ( "enable/disable disabled" , function ( ) {
Original file line number Diff line number Diff line change @@ -84,6 +84,12 @@ $.widget("ui.dialog", {
84
84
} ,
85
85
86
86
_create : function ( ) {
87
+ this . originalCss = {
88
+ display : this . element [ 0 ] . style . display ,
89
+ width : this . element [ 0 ] . style . width ,
90
+ minHeight : this . element [ 0 ] . style . minHeight ,
91
+ height : this . element [ 0 ] . style . height
92
+ } ;
87
93
this . originalTitle = this . element . attr ( "title" ) ;
88
94
this . options . title = this . options . title || this . originalTitle ;
89
95
this . oldPosition = {
@@ -127,12 +133,7 @@ $.widget("ui.dialog", {
127
133
this . element
128
134
. removeUniqueId ( )
129
135
. removeClass ( "ui-dialog-content ui-widget-content" )
130
- . css ( {
131
- width : "" ,
132
- minHeight : "" ,
133
- height : ""
134
- } )
135
- . hide ( )
136
+ . css ( this . originalCss )
136
137
// without detaching first, the following becomes really slow
137
138
. detach ( ) ;
138
139
You can’t perform that action at this time.
0 commit comments