Skip to content

Commit 5f26d83

Browse files
committed
Draggable: Added tests for opacity and zIndex
1 parent f616b62 commit 5f26d83

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tests/unit/draggable/draggable_options.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,30 @@ test("{ opacity: 0.5 }", function() {
942942

943943
});
944944

945+
test("opacity, default, switching after initialization", function() {
946+
947+
expect(3);
948+
949+
var opacity = null,
950+
el = $("#draggable2").draggable({
951+
start: function() {
952+
opacity = $(this).css("opacity");
953+
}
954+
});
955+
956+
TestHelpers.draggable.move( el, 1, 1 );
957+
equal( opacity, 1 );
958+
959+
el.draggable( "option", "opacity", 0.5 );
960+
TestHelpers.draggable.move( el, 2, 1 );
961+
equal( opacity, 0.5 );
962+
963+
el.draggable( "option", "opacity", false );
964+
TestHelpers.draggable.move( el, 3, 1 );
965+
equal( opacity, 1 );
966+
967+
});
968+
945969
test("{ zIndex: 10 }", function() {
946970

947971
expect(1);
@@ -964,4 +988,30 @@ test("{ zIndex: 10 }", function() {
964988

965989
});
966990

991+
test("zIndex, default, switching after initialization", function() {
992+
993+
expect(3);
994+
995+
var zindex = null,
996+
el = $("#draggable2").draggable({
997+
start: function() {
998+
zindex = $(this).css("z-index");
999+
}
1000+
});
1001+
1002+
el.css( "z-index", 1 );
1003+
1004+
TestHelpers.draggable.move( el, 1, 1 );
1005+
equal( zindex, 1 );
1006+
1007+
el.draggable( "option", "zIndex", 5 );
1008+
TestHelpers.draggable.move( el, 2, 1 );
1009+
equal( zindex, 5 );
1010+
1011+
el.draggable( "option", "zIndex", false );
1012+
TestHelpers.draggable.move( el, 3, 1 );
1013+
equal( zindex, 1 );
1014+
1015+
});
1016+
9671017
})(jQuery);

0 commit comments

Comments
 (0)