Browse Source

🛠 fix sorting test, use _getOption

pull/1127/head
David DeSandro 9 years ago
parent
commit
ae5027c0d9
  1. 18
      js/isotope.js
  2. 22
      test/sorting.js

18
js/isotope.js

@ -76,16 +76,6 @@ var trim = String.prototype.trim ?
return str.replace( /^\s+|\s+$/g, '' ); return str.replace( /^\s+|\s+$/g, '' );
}; };
var docElem = document.documentElement;
var getText = docElem.textContent ?
function( elem ) {
return elem.textContent;
} :
function( elem ) {
return elem.innerText;
};
// -------------------------- isotopeDefinition -------------------------- // // -------------------------- isotopeDefinition -------------------------- //
// create an Outlayer layout class // create an Outlayer layout class
@ -153,7 +143,7 @@ var getText = docElem.textContent ?
Isotope.prototype.layout = function() { Isotope.prototype.layout = function() {
// if first time doing layout, do all magic // if first time doing layout, do all magic
if ( !this._isLayoutInited && this.options.isInitLayout ) { if ( !this._isLayoutInited && this._getOption('initLayout') ) {
this.arrange(); this.arrange();
return; return;
} }
@ -208,8 +198,8 @@ var getText = docElem.textContent ?
// Don't animate/transition first layout // Don't animate/transition first layout
// Or don't animate/transition other layouts // Or don't animate/transition other layouts
Isotope.prototype._getIsInstant = function() { Isotope.prototype._getIsInstant = function() {
var isInstant = this.options.isLayoutInstant !== undefined ? var isInstant = this._getOption('initLayout') !== undefined ?
this.options.isLayoutInstant : !this._isLayoutInited; this._getOption('layoutInstant') : !this._isLayoutInited;
this._isInstant = isInstant; this._isInstant = isInstant;
return isInstant; return isInstant;
}; };
@ -390,7 +380,7 @@ var getText = docElem.textContent ?
// otherwise, assume its a querySelector, and get its text // otherwise, assume its a querySelector, and get its text
getValue = function( elem ) { getValue = function( elem ) {
var child = elem.querySelector( query ); var child = elem.querySelector( query );
return child && getText( child ); return child && child.textContent;
}; };
} }
return getValue; return getValue;

22
test/sorting.js

@ -1,16 +1,7 @@
( function() {
'use strict';
function getItemsText( iso ) {
var texts = iso.filteredItems.map( function( item ) {
return item.element.textContent;
})
return texts.join(',');
}
test( 'sorting', function() { test( 'sorting', function() {
'use strict';
// sorting with history // sorting with history
( function() { ( function() {
var iso = new Isotope( '#sorting1', { var iso = new Isotope( '#sorting1', {
@ -62,6 +53,11 @@ test( 'sorting', function() {
iso.destroy(); iso.destroy();
})(); })();
}); function getItemsText( iso ) {
var texts = iso.filteredItems.map( function( item ) {
return item.element.textContent;
});
return texts.join(',');
}
})(); });

Loading…
Cancel
Save