Browse Source

.magic -> .arrange

pull/563/head
David DeSandro 11 years ago
parent
commit
4d10ee57a9
  1. 8
      js/isotope.js
  2. 2
      notes.md
  3. 6
      test/filtering.js
  4. 10
      test/layout-complete.js
  5. 6
      test/sorting.js

8
js/isotope.js

@ -107,7 +107,7 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
Isotope.prototype.layout = function() {
// if first time doing layout, do all magic
if ( !this._isLayoutInited && this.options.isInitLayout ) {
this.magic();
this.arrange();
return;
}
this._layout();
@ -127,7 +127,7 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
};
// filter + sort + layout
Isotope.prototype.magic = function( opts ) {
Isotope.prototype.arrange = function( opts ) {
// set any options pass
this.option( opts );
this._getIsInstant();
@ -136,8 +136,8 @@ function isotopeDefinition( Outlayer, getSize, matchesSelector, Item, LayoutMode
this._sort();
this._layout();
};
// alias
Isotope.prototype.filterSortLayout = Isotope.prototype.magic;
// alias to _init for main plugin method
Isotope.prototype._init = Isotope.prototype.arrange;
// HACK
// Don't animate/transition first layout

2
notes.md

@ -47,7 +47,7 @@ iso.display({})
Orrrrrr keep .layout() and have reLayout()
---
## Isotope vs Masonry vs Packery
Masonry Isotope Packery
Masonry Layouts x x x

6
test/filtering.js

@ -35,7 +35,7 @@ test( 'filtering', function() {
equal( ids, '1,2,3,4,5,6,7', 'all items there by default' );
function checkFilter( filter, expectedIDs, message ) {
iso.magic({ filter: filter });
iso.arrange({ filter: filter });
ids = getFilteredItemIDs( iso );
equal( ids, expectedIDs, message || filter );
}
@ -44,7 +44,7 @@ test( 'filtering', function() {
checkFilter( '.tall', '3,4,7' );
checkFilter( '.tall.orange', '3,7' );
iso.magic({
iso.arrange({
filter: function( elem ) {
var num = parseInt( getText( elem ), 10 );
return num > 5;
@ -63,7 +63,7 @@ test( 'filtering', function() {
checkFilter( ':not(.orange)', '2,4,5' );
checkFilter( '.orange:not(.tall)', '1,6' );
iso.magic({
iso.arrange({
filter: function() {
var num = parseInt( $(this).text(), 10 );
return num > 5;

10
test/layout-complete.js

@ -14,7 +14,7 @@ test( 'layoutComplete', function() {
next();
});
iso.magic({
iso.arrange({
filter: '.a1'
});
},
@ -24,7 +24,7 @@ test( 'layoutComplete', function() {
next();
});
iso.magic({
iso.arrange({
filter: '.b2'
});
},
@ -34,7 +34,7 @@ test( 'layoutComplete', function() {
next();
});
iso.magic({
iso.arrange({
sortBy: 'random'
});
},
@ -44,13 +44,13 @@ test( 'layoutComplete', function() {
next();
});
iso.magic({
iso.arrange({
filter: '.a2',
transitionDuration: '0.6s'
});
setTimeout( function() {
iso.magic({
iso.arrange({
filter: '.b2'
});
}, 300 );

6
test/sorting.js

@ -25,7 +25,7 @@ test( 'sorting', function() {
sortBy: 'number'
});
iso.magic({ sortBy: 'letter' });
iso.arrange({ sortBy: 'letter' });
var texts = getItemsText( iso );
@ -48,12 +48,12 @@ test( 'sorting', function() {
equal( getItemsText( iso ), 'A1,A2,A3,A4,B1,B2,B4', 'sortBy array' );
iso.magic({
iso.arrange({
sortAscending: false
});
equal( getItemsText( iso ), 'B4,B2,B1,A4,A3,A2,A1', 'sortAscending false' );
iso.magic({
iso.arrange({
sortAscending: {
letter: true,
number: false

Loading…
Cancel
Save