Draggable Tests: Clarify position helper test generation

This commit is contained in:
Mike Sherov 2014-08-14 21:03:18 -04:00
parent 2d03839c07
commit 01e26b0f53

View File

@ -671,25 +671,7 @@ test( "helper, default, switching after initialization", function() {
TestHelpers.draggable.shouldMove( element, "helper: original" );
});
/* jshint loopfunc: true */
(function() {
var k, l, m,
scrollElements = {
"no elements": [],
"parent": [ "#main" ],
"root": [ document ],
"parent and root": [ "#main", document ],
"grandparent": [ "#scrollParent" ]
},
positions = [ "absolute", "fixed", "relative", "static" ],
helpers = [ "original", "clone" ],
// static is not an option here since the fixture is in an absolute container
scrollPositions = [ "relative", "absolute", "fixed" ];
for ( m = 0 ; m < helpers.length; m++ ) {
for ( l = 0; l < positions.length; l++ ) {
for ( k in scrollElements ) {
(function( position, helper, scrollElements, scrollElementsTitle ) {
function testHelperPosition( scrollPositions, position, helper, scrollElements, scrollElementsTitle ) {
test( "{ helper: '" + helper + "' }, " + position + ", with scroll offset on " + scrollElementsTitle, function() {
expect( scrollPositions.length * 2 );
@ -721,12 +703,31 @@ test( "helper, default, switching after initialization", function() {
TestHelpers.draggable.setScrollable( "#scrollParent", false );
}
});
})( positions[ l ], helpers[ m ], scrollElements[ k ], k );
}
}
}
}
(function() {
var scrollElementsMap = {
"no elements": [],
"parent": [ "#main" ],
"root": [ document ],
"parent and root": [ "#main", document ],
"grandparent": [ "#scrollParent" ]
},
positions = [ "absolute", "fixed", "relative", "static" ],
helpers = [ "original", "clone" ],
// static is not an option here since the fixture is in an absolute container
scrollPositions = [ "relative", "absolute", "fixed" ];
$.each( helpers, function() {
var helper = this;
$.each( positions, function() {
var position = this;
$.each( scrollElementsMap, function( scrollElementsTitle, scrollElements ) {
testHelperPosition( scrollPositions, position, helper, scrollElements, scrollElementsTitle );
});
});
});
})();
/* jshint loopfunc: false */
test( "{ opacity: 0.5 }", function() {
expect( 1 );