Skip to content

Commit 1b932bb

Browse files
araghavamarkelog
authored andcommitted
CSS: Add unit tests for negative margins and positioning
Closes gh-1957
1 parent d21edb5 commit 1b932bb

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
@@ -248,6 +248,21 @@ test("css(String, Object)", function() {
248248
"Set font shorthand property (#14759)" );
249249
});
250250

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

0 commit comments

Comments
 (0)