From 5f26d83c787a44d86232a10324e197471e5ddffe Mon Sep 17 00:00:00 2001 From: Dave Stein Date: Tue, 15 Jan 2013 19:32:06 -0500 Subject: [PATCH] Draggable: Added tests for opacity and zIndex --- tests/unit/draggable/draggable_options.js | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js index c01efc324..6f7e06ce7 100644 --- a/tests/unit/draggable/draggable_options.js +++ b/tests/unit/draggable/draggable_options.js @@ -942,6 +942,30 @@ test("{ opacity: 0.5 }", function() { }); +test("opacity, default, switching after initialization", function() { + + expect(3); + + var opacity = null, + el = $("#draggable2").draggable({ + start: function() { + opacity = $(this).css("opacity"); + } + }); + + TestHelpers.draggable.move( el, 1, 1 ); + equal( opacity, 1 ); + + el.draggable( "option", "opacity", 0.5 ); + TestHelpers.draggable.move( el, 2, 1 ); + equal( opacity, 0.5 ); + + el.draggable( "option", "opacity", false ); + TestHelpers.draggable.move( el, 3, 1 ); + equal( opacity, 1 ); + +}); + test("{ zIndex: 10 }", function() { expect(1); @@ -964,4 +988,30 @@ test("{ zIndex: 10 }", function() { }); +test("zIndex, default, switching after initialization", function() { + + expect(3); + + var zindex = null, + el = $("#draggable2").draggable({ + start: function() { + zindex = $(this).css("z-index"); + } + }); + + el.css( "z-index", 1 ); + + TestHelpers.draggable.move( el, 1, 1 ); + equal( zindex, 1 ); + + el.draggable( "option", "zIndex", 5 ); + TestHelpers.draggable.move( el, 2, 1 ); + equal( zindex, 5 ); + + el.draggable( "option", "zIndex", false ); + TestHelpers.draggable.move( el, 3, 1 ); + equal( zindex, 1 ); + +}); + })(jQuery);