Filter & sort magical layouts http://isotope.metafizzy.co
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
886 B

( function() {
'use strict';
test( 'fitRows', function() {
var iso = new Isotope( '#fitrows-gutter', {
layoutMode: 'fitRows',
itemSelector: '.item',
transitionDuration: 0
});
function checkPosition( item, x, y ) {
var elem = item.element;
var left = parseInt( elem.style.left, 10 );
var top = parseInt( elem.style.top, 10 );
deepEqual( [ left, top ], [ x, y ], 'item position ' + x + ', ' + y );
}
checkPosition( iso.items[0], 0, 0 );
checkPosition( iso.items[1], 60, 0 );
// check gutter
iso.options.fitRows = {
gutter: 10
};
iso.layout();
checkPosition( iso.items[0], 0, 0 );
checkPosition( iso.items[1], 70, 0 );
// check gutter, with element sizing
iso.options.fitRows = {
gutter: '.gutter-sizer'
};
iso.layout();
checkPosition( iso.items[0], 0, 0 );
checkPosition( iso.items[1], 78, 0 );
});
})();