@@ -31,59 +31,19 @@ test( "Immediate Return Conditions", function() {
31
31
equal ( ++ count , 3 , "Both Functions worked properly" ) ;
32
32
} ) ;
33
33
34
- $ . each ( $ . effects . effect , function ( effect ) {
35
- if ( effect === "transfer" ) {
36
- return ;
37
- }
38
- module ( "effect." + effect ) ;
39
- asyncTest ( "show/hide" , function ( ) {
40
- var hidden = $ ( "div.hidden" ) ;
41
- expect ( 8 ) ;
42
-
43
- var count = 0 ,
44
- test = 0 ;
45
-
46
- function queueTest ( fn ) {
47
- count ++ ;
48
- var point = count ;
49
- return function ( next ) {
50
- test ++ ;
51
- equal ( point , test , "Queue function fired in order" ) ;
52
- if ( fn ) {
53
- fn ( ) ;
54
- } else {
55
- setTimeout ( next , minDuration ) ;
56
- }
57
- } ;
58
- }
59
-
60
- hidden . queue ( queueTest ( ) ) . show ( effect , minDuration , queueTest ( function ( ) {
61
- equal ( hidden . css ( "display" ) , "block" , "Hidden is shown after .show(\"" + effect + "\", time)" ) ;
62
- } ) ) . queue ( queueTest ( ) ) . hide ( effect , minDuration , queueTest ( function ( ) {
63
- equal ( hidden . css ( "display" ) , "none" , "Back to hidden after .hide(\"" + effect + "\", time)" ) ;
64
- } ) ) . queue ( queueTest ( function ( next ) {
65
- deepEqual ( hidden . queue ( ) , [ "inprogress" ] , "Only the inprogress sentinel remains" ) ;
66
- start ( ) ;
67
- } ) ) ;
68
- } ) ;
69
-
70
- asyncTest ( "relative width & height - properties are preserved" , function ( ) {
71
- var test = $ ( "div.relWidth.relHeight" ) ,
72
- width = test . width ( ) , height = test . height ( ) ,
73
- cssWidth = test [ 0 ] . style . width , cssHeight = test [ 0 ] . style . height ;
34
+ test ( "createWrapper and removeWrapper retain focused elements (#7595)" , function ( ) {
35
+ expect ( 2 ) ;
36
+ var test = $ ( "div.hidden" ) . show ( ) ,
37
+ input = $ ( "<input>" ) . appendTo ( test ) . focus ( ) ;
74
38
75
- expect ( 4 ) ;
76
- test . toggle ( effect , minDuration , function ( ) {
77
- equal ( test [ 0 ] . style . width , cssWidth , "Inline CSS Width has been reset after animation ended" ) ;
78
- equal ( test [ 0 ] . style . height , cssHeight , "Inline CSS Height has been rest after animation ended" ) ;
79
- start ( ) ;
80
- } ) ;
81
- equal ( test . width ( ) , width , "Width is the same px after animation started" ) ;
82
- equal ( test . height ( ) , height , "Height is the same px after animation started" ) ;
83
- } ) ;
39
+ $ . effects . createWrapper ( test ) ;
40
+ equal ( document . activeElement , input [ 0 ] , "Active element is still input after createWrapper" ) ;
41
+ $ . effects . removeWrapper ( test ) ;
42
+ equal ( document . activeElement , input [ 0 ] , "Active element is still input after removeWrapper" ) ;
84
43
} ) ;
85
44
86
- module ( "animateClass" ) ;
45
+
46
+ module ( "effects.core: animateClass" ) ;
87
47
88
48
asyncTest ( "animateClass works with borderStyle" , function ( ) {
89
49
var test = $ ( "div.animateClass" ) ,
@@ -150,15 +110,73 @@ asyncTest( "animateClass clears style properties when stopped", function() {
150
110
start ( ) ;
151
111
} ) ;
152
112
153
- test ( "createWrapper and removeWrapper retain focused elements (#7595)" , function ( ) {
154
- expect ( 2 ) ;
155
- var test = $ ( "div.hidden" ) . show ( ) ,
156
- input = $ ( "<input>" ) . appendTo ( test ) . focus ( ) ;
113
+ asyncTest ( "animateClass: css and class changes during animation are not lost (#7106)" , function ( ) {
114
+ var test = $ ( "div.ticket7106" ) ;
157
115
158
- $ . effects . createWrapper ( test ) ;
159
- equal ( document . activeElement , input [ 0 ] , "Active element is still input after createWrapper" ) ;
160
- $ . effects . removeWrapper ( test ) ;
161
- equal ( document . activeElement , input [ 0 ] , "Active element is still input after removeWrapper" ) ;
162
- } )
116
+ // add a class and change a style property after starting an animated class
117
+ test . addClass ( "animate" , minDuration , animationComplete )
118
+ . addClass ( "testClass" )
119
+ . height ( 100 ) ;
120
+
121
+ // ensure the class stays and that the css property stays
122
+ function animationComplete ( ) {
123
+ ok ( test . hasClass ( "testClass" ) , "class change during animateClass was not lost" ) ;
124
+ equal ( test . height ( ) , 100 , "css change during animateClass was not lost" ) ;
125
+ start ( ) ;
126
+ }
127
+ } ) ;
128
+
129
+
130
+ $ . each ( $ . effects . effect , function ( effect ) {
131
+ if ( effect === "transfer" ) {
132
+ return ;
133
+ }
134
+ module ( "effect." + effect ) ;
135
+ asyncTest ( "show/hide" , function ( ) {
136
+ var hidden = $ ( "div.hidden" ) ;
137
+ expect ( 8 ) ;
138
+
139
+ var count = 0 ,
140
+ test = 0 ;
141
+
142
+ function queueTest ( fn ) {
143
+ count ++ ;
144
+ var point = count ;
145
+ return function ( next ) {
146
+ test ++ ;
147
+ equal ( point , test , "Queue function fired in order" ) ;
148
+ if ( fn ) {
149
+ fn ( ) ;
150
+ } else {
151
+ setTimeout ( next , minDuration ) ;
152
+ }
153
+ } ;
154
+ }
155
+
156
+ hidden . queue ( queueTest ( ) ) . show ( effect , minDuration , queueTest ( function ( ) {
157
+ equal ( hidden . css ( "display" ) , "block" , "Hidden is shown after .show(\"" + effect + "\", time)" ) ;
158
+ } ) ) . queue ( queueTest ( ) ) . hide ( effect , minDuration , queueTest ( function ( ) {
159
+ equal ( hidden . css ( "display" ) , "none" , "Back to hidden after .hide(\"" + effect + "\", time)" ) ;
160
+ } ) ) . queue ( queueTest ( function ( next ) {
161
+ deepEqual ( hidden . queue ( ) , [ "inprogress" ] , "Only the inprogress sentinel remains" ) ;
162
+ start ( ) ;
163
+ } ) ) ;
164
+ } ) ;
165
+
166
+ asyncTest ( "relative width & height - properties are preserved" , function ( ) {
167
+ var test = $ ( "div.relWidth.relHeight" ) ,
168
+ width = test . width ( ) , height = test . height ( ) ,
169
+ cssWidth = test [ 0 ] . style . width , cssHeight = test [ 0 ] . style . height ;
170
+
171
+ expect ( 4 ) ;
172
+ test . toggle ( effect , minDuration , function ( ) {
173
+ equal ( test [ 0 ] . style . width , cssWidth , "Inline CSS Width has been reset after animation ended" ) ;
174
+ equal ( test [ 0 ] . style . height , cssHeight , "Inline CSS Height has been rest after animation ended" ) ;
175
+ start ( ) ;
176
+ } ) ;
177
+ equal ( test . width ( ) , width , "Width is the same px after animation started" ) ;
178
+ equal ( test . height ( ) , height , "Height is the same px after animation started" ) ;
179
+ } ) ;
180
+ } ) ;
163
181
164
182
} ) ( jQuery ) ;
0 commit comments