Skip to content

Commit e9e7db4

Browse files
rwaldrontimmywil
authored andcommitted
Landing pull request 466. Test if opacity is not expected val. Fixes effects test suite.
More Details: - jquery#466
1 parent 5209dd7 commit e9e7db4

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

test/unit/effects.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ test("Persist correct display value", function() {
169169

170170
test("show() resolves correct default display #8099", function() {
171171
expect(7);
172-
var tt8099 = jQuery("<tt/>").appendTo("body"),
172+
var tt8099 = jQuery("<tt/>").appendTo("body"),
173173
dfn8099 = jQuery("<dfn/>", { html: "foo"}).appendTo("body");
174174

175175
equals( tt8099.css("display"), "none", "default display override for all tt" );
@@ -726,6 +726,7 @@ jQuery.each( {
726726
var f_h = f( elem, "height" );
727727
var t_o = t( elem, "opacity" );
728728
var f_o = f( elem, "opacity" );
729+
729730
if ( f_o === "" ) {
730731
f_o = 1;
731732
}
@@ -753,22 +754,39 @@ jQuery.each( {
753754

754755
elem = elem[ 0 ];
755756

756-
if ( t_w == "show" )
757+
if ( t_w == "show" ) {
757758
equals( elem.style.display, "block", "Showing, display should block: " + elem.style.display);
759+
}
758760

759-
if ( t_w == "hide"||t_w == "show" )
761+
if ( t_w == "hide"||t_w == "show" ) {
760762
ok(f_w === "" ? elem.style.width === f_w : elem.style.width.indexOf(f_w) === 0, "Width must be reset to " + f_w + ": " + elem.style.width);
763+
}
761764

762-
if ( t_h == "hide"||t_h == "show" )
765+
if ( t_h == "hide"||t_h == "show" ) {
763766
ok(f_h === "" ? elem.style.height === f_h : elem.style.height.indexOf(f_h) === 0, "Height must be reset to " + f_h + ": " + elem.style.height);
767+
}
768+
769+
var cur_o = jQuery.style(elem, "opacity");
770+
771+
if ( f_o !== jQuery.css(elem, "opacity") ) {
772+
f_o = f( elem, "opacity" );
773+
}
774+
775+
if ( f_o === "" ) {
776+
f_o = 1;
777+
}
764778

765-
var cur_o = jQuery.css(elem, "opacity");
779+
if ( cur_o === "" ) {
780+
cur_o = 1;
781+
}
766782

767-
if ( t_o == "hide" || t_o == "show" )
783+
if ( t_o == "hide" || t_o == "show" ) {
768784
equals(cur_o, f_o, "Opacity must be reset to " + f_o + ": " + cur_o);
785+
}
769786

770-
if ( t_w == "hide" )
787+
if ( t_w == "hide" ) {
771788
equals(elem.style.display, "none", "Hiding, display should be none: " + elem.style.display);
789+
}
772790

773791
if ( t_o.constructor == Number ) {
774792
equals(cur_o, t_o, "Final opacity should be " + t_o + ": " + cur_o);

0 commit comments

Comments
 (0)