Skip to content

Commit f520f9e

Browse files
committed
Effects: Style updates
Ref #14246
1 parent e021e4d commit f520f9e

File tree

3 files changed

+89
-88
lines changed

3 files changed

+89
-88
lines changed

tests/unit/effects/core.js

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,33 @@ asyncTest( ".hide() with step", function() {
4545
step = $.noop;
4646
};
4747

48-
element.hide({
48+
element.hide( {
4949
step: function() {
5050
step();
5151
},
5252
complete: start
53-
});
54-
});
53+
} );
54+
} );
5555

5656
test( "Immediate Return Conditions", function() {
5757
var hidden = $( "div.hidden" ),
5858
count = 0;
5959
expect( 3 );
6060
hidden.hide( "blind", function() {
6161
equal( ++count, 1, "Hide on hidden returned immediately" );
62-
}).show().show( "blind", function() {
62+
} ).show().show( "blind", function() {
6363
equal( ++count, 2, "Show on shown returned immediately" );
64-
});
64+
} );
6565
equal( ++count, 3, "Both Functions worked properly" );
66-
});
66+
} );
6767

6868
test( ".hide() with hidden parent", function() {
6969
expect( 1 );
7070
var element = $( "div.hidden" ).children();
7171
element.hide( "blind", function() {
7272
equal( element.css( "display" ), "none", "display: none" );
73-
});
74-
});
73+
} );
74+
} );
7575

7676
asyncTest( "Parse of null for options", function() {
7777
var hidden = $( "div.hidden" ),
@@ -80,8 +80,8 @@ asyncTest( "Parse of null for options", function() {
8080
hidden.show( "blind", null, 1, function() {
8181
equal( ++count, 1, "null for options still works" );
8282
start();
83-
});
84-
});
83+
} );
84+
} );
8585

8686
test( "removeClass", function() {
8787
expect( 3 );
@@ -92,28 +92,28 @@ test( "removeClass", function() {
9292
equal( "destroyed", element[ 0 ].className );
9393
element.removeClass();
9494
equal( "", element[ 0 ].className );
95-
});
95+
} );
9696

9797
module( "effects.core: animateClass" );
9898

9999
asyncTest( "animateClass works with borderStyle", function() {
100-
var test = $("div.animateClass");
101-
expect(3);
102-
test.toggleClass("testAddBorder", minDuration, function() {
103-
test.toggleClass("testAddBorder", minDuration, function() {
104-
equal( test.css("borderLeftStyle"), "none", "None border set" );
100+
var test = $( "div.animateClass" );
101+
expect( 3 );
102+
test.toggleClass( "testAddBorder", minDuration, function() {
103+
test.toggleClass( "testAddBorder", minDuration, function() {
104+
equal( test.css( "borderLeftStyle" ), "none", "None border set" );
105105
start();
106-
});
107-
equal( test.css("borderLeftStyle"), "solid", "None border not immedately set" );
108-
});
109-
equal( test.css("borderLeftStyle"), "solid", "Solid border immedately set" );
110-
});
106+
} );
107+
equal( test.css( "borderLeftStyle" ), "solid", "None border not immedately set" );
108+
} );
109+
equal( test.css( "borderLeftStyle" ), "solid", "Solid border immedately set" );
110+
} );
111111

112112
asyncTest( "animateClass works with colors", function() {
113-
var test = $("div.animateClass"),
113+
var test = $( "div.animateClass" ),
114114
oldStep = jQuery.fx.step.backgroundColor;
115115

116-
expect(2);
116+
expect( 2 );
117117

118118
// We want to catch the first frame of animation
119119
jQuery.fx.step.backgroundColor = function( fx ) {
@@ -122,21 +122,21 @@ asyncTest( "animateClass works with colors", function() {
122122
// Make sure it has animated somewhere we can detect
123123
if ( fx.pos > 255 / 2000 ) {
124124
jQuery.fx.step.backgroundColor = oldStep;
125-
notPresent( test.css("backgroundColor"),
125+
notPresent( test.css( "backgroundColor" ),
126126
[ "#000000", "#ffffff", "#000", "#fff", "rgb(0, 0, 0)", "rgb(255,255,255)" ],
127127
"Color is not endpoints in middle." );
128128
test.stop( true, true );
129129
}
130130
};
131131

132-
test.toggleClass("testChangeBackground", {
132+
test.toggleClass( "testChangeBackground", {
133133
duration: 2000,
134134
complete: function() {
135-
present( test.css("backgroundColor"), [ "#ffffff", "#fff", "rgb(255, 255, 255)" ], "Color is final" );
135+
present( test.css( "backgroundColor" ), [ "#ffffff", "#fff", "rgb(255, 255, 255)" ], "Color is final" );
136136
start();
137137
}
138-
});
139-
});
138+
} );
139+
} );
140140

141141
asyncTest( "animateClass calls step option", 1, function() {
142142
var test = jQuery( "div.animateClass" ),
@@ -150,23 +150,23 @@ asyncTest( "animateClass calls step option", 1, function() {
150150
step: function() {
151151
step();
152152
}
153-
});
154-
});
153+
} );
154+
} );
155155

156156
asyncTest( "animateClass works with children", 3, function() {
157157
var animatedChild,
158-
test = $("div.animateClass"),
159-
h2 = test.find("h2");
158+
test = $( "div.animateClass" ),
159+
h2 = test.find( "h2" );
160160

161-
test.toggleClass("testChildren", {
161+
test.toggleClass( "testChildren", {
162162
children: true,
163163
duration: duration,
164164
complete: function() {
165-
equal( h2.css("fontSize"), "20px", "Text size is final during complete");
166-
test.toggleClass("testChildren", {
165+
equal( h2.css( "fontSize" ), "20px", "Text size is final during complete" );
166+
test.toggleClass( "testChildren", {
167167
duration: duration,
168168
complete: function() {
169-
equal( h2.css("fontSize"), "10px", "Text size revertted after class removed");
169+
equal( h2.css( "fontSize" ), "10px", "Text size revertted after class removed" );
170170

171171
start();
172172
},
@@ -175,20 +175,20 @@ asyncTest( "animateClass works with children", 3, function() {
175175
ok( false, "Error - Animating property on h2" );
176176
}
177177
}
178-
});
178+
} );
179179
},
180180
step: function( val, fx ) {
181181
if ( fx.prop === "fontSize" && fx.elem === h2[ 0 ] && !animatedChild ) {
182182
equal( fx.end, 20, "animating font size on child" );
183183
animatedChild = true;
184184
}
185185
}
186-
});
187-
});
186+
} );
187+
} );
188188

189189
asyncTest( "animateClass clears style properties when stopped", function() {
190-
var test = $("div.animateClass"),
191-
style = test[0].style,
190+
var test = $( "div.animateClass" ),
191+
style = test[ 0 ].style,
192192
orig = style.cssText;
193193

194194
expect( 2 );
@@ -199,7 +199,7 @@ asyncTest( "animateClass clears style properties when stopped", function() {
199199
test.stop( true, true );
200200
equal( orig, $.trim( style.cssText ), "cssText is the same after stopping animation midway" );
201201
start();
202-
});
202+
} );
203203

204204
asyncTest( "animateClass: css and class changes during animation are not lost (#7106)",
205205
function( assert ) {
@@ -217,7 +217,7 @@ function( assert ) {
217217
test.addClass( "animate", minDuration, animationComplete )
218218
.addClass( "testClass" )
219219
.height( 100 );
220-
});
220+
} );
221221

222222
test( "createPlaceholder: only created for static or relative elements", function() {
223223
expect( 4 );
@@ -226,16 +226,16 @@ test( "createPlaceholder: only created for static or relative elements", functio
226226
ok( $.effects.createPlaceholder( $( ".static" ) ).length, "placeholder created for static element" );
227227
ok( !$.effects.createPlaceholder( $( ".absolute" ) ), "placeholder not created for absolute element" );
228228
ok( !$.effects.createPlaceholder( $( ".fixed" ) ), "placeholder not created for fixed element" );
229-
});
229+
} );
230230

231231
test( "createPlaceholder: preserves layout affecting properties", function() {
232232
expect( 7 );
233233

234234
var position = 5,
235-
element = $( ".relative" ).css({
235+
element = $( ".relative" ).css( {
236236
top: position,
237237
left: position
238-
}),
238+
} ),
239239
before = {
240240
offset: element.offset(),
241241
outerWidth: element.outerWidth( true ),
@@ -253,10 +253,10 @@ test( "createPlaceholder: preserves layout affecting properties", function() {
253253
deepEqual( before.position.top - position, placeholder.position().top, "position top preserved" );
254254
deepEqual( before.position.left - position, placeholder.position().left, "position left preserved" );
255255

256-
deepEqual( before[ "float" ], placeholder.css( "float" ), "float preserved" );
256+
deepEqual( before.float, placeholder.css( "float" ), "float preserved" );
257257
deepEqual( before.outerWidth, placeholder.outerWidth( true ), "width preserved" );
258258
deepEqual( before.outerHeight, placeholder.outerHeight( true ), "height preserved" );
259-
});
259+
} );
260260

261261
module( "transfer" );
262262

@@ -321,47 +321,47 @@ $.each( $.effects.effect, function( effect ) {
321321

322322
hidden
323323
.queue( queueTest() )
324-
.queue( duringTest(function() {
324+
.queue( duringTest( function() {
325325
ok( hidden.is( ":animated" ),
326326
"Hidden is seen as animated during .show(\"" + effect + "\", time)" );
327-
}) )
328-
.show( effect, minDuration, queueTest(function() {
327+
} ) )
328+
.show( effect, minDuration, queueTest( function() {
329329
equal( hidden.css( "display" ), "block",
330330
"Hidden is shown after .show(\"" + effect + "\", time)" );
331331
ok( !$( ".ui-effects-placeholder" ).length,
332332
"No placeholder remains after .show(\"" + effect + "\", time)" );
333-
}) )
333+
} ) )
334334
.queue( queueTest() )
335-
.queue( duringTest(function() {
335+
.queue( duringTest( function() {
336336
ok( hidden.is( ":animated" ),
337337
"Hidden is seen as animated during .hide(\"" + effect + "\", time)" );
338-
}) )
339-
.hide( effect, minDuration, queueTest(function() {
338+
} ) )
339+
.hide( effect, minDuration, queueTest( function() {
340340
equal( hidden.css( "display" ), "none",
341341
"Back to hidden after .hide(\"" + effect + "\", time)" );
342342
ok( !$( ".ui-effects-placeholder" ).length,
343343
"No placeholder remains after .hide(\"" + effect + "\", time)" );
344-
}) )
345-
.queue( queueTest(function() {
344+
} ) )
345+
.queue( queueTest( function() {
346346
deepEqual( hidden.queue(), [ "inprogress" ], "Only the inprogress sentinel remains" );
347347
start();
348-
}) );
349-
});
348+
} ) );
349+
} );
350350

351351
asyncTest( "relative width & height - properties are preserved", function() {
352-
var test = $("div.relWidth.relHeight"),
352+
var test = $( "div.relWidth.relHeight" ),
353353
width = test.width(), height = test.height(),
354-
cssWidth = test[0].style.width, cssHeight = test[0].style.height;
354+
cssWidth = test[ 0 ].style.width, cssHeight = test[ 0 ].style.height;
355355

356356
expect( 4 );
357357
test.toggle( effect, minDuration, function() {
358-
equal( test[0].style.width, cssWidth, "Inline CSS Width has been reset after animation ended" );
359-
equal( test[0].style.height, cssHeight, "Inline CSS Height has been rest after animation ended" );
358+
equal( test[ 0 ].style.width, cssWidth, "Inline CSS Width has been reset after animation ended" );
359+
equal( test[ 0 ].style.height, cssHeight, "Inline CSS Height has been rest after animation ended" );
360360
start();
361-
});
361+
} );
362362
equal( test.width(), width, "Width is the same px after animation started" );
363363
equal( test.height(), height, "Height is the same px after animation started" );
364-
});
365-
});
364+
} );
365+
} );
366366

367367
} );

tests/unit/effects/scale.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function run( position, v, h, vo, ho ) {
4141
}
4242
test.css( css );
4343
test.effect( effect );
44-
});
44+
} );
4545
}
4646

4747
function suite( position ) {
@@ -55,18 +55,18 @@ function suite( position ) {
5555
*/
5656
}
5757

58-
$(function() {
58+
$( function() {
5959
suite( "absolute" );
6060
suite( "relative" );
6161
var fixedElem = $( "<div>" )
62-
.css({
62+
.css( {
6363
position: "fixed",
6464
top: 10
65-
})
65+
} )
6666
.appendTo( "body" );
6767
if ( fixedElem.offset().top === 10 ) {
6868
suite( "fixed" );
6969
}
70-
});
70+
} );
7171

7272
} );

0 commit comments

Comments
 (0)