diff options
Diffstat (limited to 'test/unit/css.js')
-rw-r--r-- | test/unit/css.js | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/test/unit/css.js b/test/unit/css.js index 75d1db84e..5c9f3e01f 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -471,6 +471,9 @@ QUnit.test( "css(Object) where values are Functions with incoming values", funct jQuery( "#cssFunctionTest" ).remove(); } ); +// .show(), .hide(), can be excluded from the build +if ( jQuery.fn.show && jQuery.fn.hide ) { + QUnit.test( "show(); hide()", function( assert ) { assert.expect( 4 ); @@ -636,6 +639,35 @@ QUnit.test( "show() resolves correct default display for detached nodes", functi span.remove(); } ); +QUnit.test( "hide hidden elements (bug #7141)", function( assert ) { + assert.expect( 3 ); + + var div = jQuery( "<div style='display:none'></div>" ).appendTo( "#qunit-fixture" ); + assert.equal( div.css( "display" ), "none", "Element is hidden by default" ); + div.hide(); + assert.ok( !jQuery._data( div, "olddisplay" ), "olddisplay is undefined after hiding an already-hidden element" ); + div.show(); + assert.equal( div.css( "display" ), "block", "Show a double-hidden element" ); + + div.remove(); +} ); + +QUnit.test( "show() after hide() should always set display to initial value (#14750)", function( assert ) { + assert.expect( 1 ); + + var div = jQuery( "<div />" ), + fixture = jQuery( "#qunit-fixture" ); + + fixture.append( div ); + + div.css( "display", "inline" ).hide().show().css( "display", "list-item" ).hide().show(); + assert.equal( div.css( "display" ), "list-item", "should get last set display value" ); +} ); + +} + +if ( jQuery.fn.toggle ) { + QUnit.test( "toggle()", function( assert ) { assert.expect( 9 ); var div, oldHide, @@ -669,18 +701,7 @@ QUnit.test( "toggle()", function( assert ) { jQuery.fn.hide = oldHide; } ); -QUnit.test( "hide hidden elements (bug #7141)", function( assert ) { - assert.expect( 3 ); - - var div = jQuery( "<div style='display:none'></div>" ).appendTo( "#qunit-fixture" ); - assert.equal( div.css( "display" ), "none", "Element is hidden by default" ); - div.hide(); - assert.ok( !jQuery._data( div, "olddisplay" ), "olddisplay is undefined after hiding an already-hidden element" ); - div.show(); - assert.equal( div.css( "display" ), "block", "Show a double-hidden element" ); - - div.remove(); -} ); +} QUnit.test( "jQuery.css(elem, 'height') doesn't clear radio buttons (bug #1095)", function( assert ) { assert.expect( 4 ); @@ -1128,18 +1149,6 @@ QUnit.test( } ); -QUnit.test( "show() after hide() should always set display to initial value (#14750)", function( assert ) { - assert.expect( 1 ); - - var div = jQuery( "<div />" ), - fixture = jQuery( "#qunit-fixture" ); - - fixture.append( div ); - - div.css( "display", "inline" ).hide().show().css( "display", "list-item" ).hide().show(); - assert.equal( div.css( "display" ), "list-item", "should get last set display value" ); -} ); - // Support: IE < 11 // We have to jump through the hoops here in order to test work with "order" CSS property, // that some browsers do not support. This test is not, strictly speaking, correct, |