Skip to content

Commit ae30fb6

Browse files
araghavamarkelog
authored andcommitted
CSS: Add unit tests for negative margins and positioning
Ref 1b932bb
1 parent 2c14b00 commit ae30fb6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/unit/css.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,21 @@ test("css(String, Object)", function() {
251251
"Set font shorthand property (#14759)" );
252252
});
253253

254+
test( "css(String, Object) with negative values", function() {
255+
expect( 4 );
256+
257+
jQuery( "#nothiddendiv" ).css( "margin-top", "-10px" );
258+
jQuery( "#nothiddendiv" ).css( "margin-left", "-10px" );
259+
equal( jQuery( "#nothiddendiv" ).css( "margin-top" ), "-10px", "Ensure negative top margins work." );
260+
equal( jQuery( "#nothiddendiv" ).css( "margin-left" ), "-10px", "Ensure negative left margins work." );
261+
262+
jQuery( "#nothiddendiv" ).css( "position", "absolute" );
263+
jQuery( "#nothiddendiv" ).css( "top", "-20px" );
264+
jQuery( "#nothiddendiv" ).css( "left", "-20px" );
265+
equal( jQuery( "#nothiddendiv" ).css( "top" ), "-20px", "Ensure negative top values work." );
266+
equal( jQuery( "#nothiddendiv" ).css( "left" ), "-20px", "Ensure negative left values work." );
267+
});
268+
254269
test( "css(Array)", function() {
255270
expect( 2 );
256271

0 commit comments

Comments
 (0)