Add test for removesInactiveExchanges

This commit is contained in:
Rohan Mitchell
2012-12-13 14:55:11 +11:00
parent bec10be233
commit 8d8c2f04d8
2 changed files with 31 additions and 6 deletions

View File

@@ -119,12 +119,16 @@ angular.module('order_cycle', ['ngResource']).
},
removeInactiveExchanges: function() {
for(var i=0; i < this.order_cycle.incoming_exchanges.length; i++) {
if(!this.order_cycle.incoming_exchanges[i].active) {
this.order_cycle.incoming_exchanges.splice(i, 1);
i--;
}
}
angular.forEach([this.order_cycle.incoming_exchanges,
this.order_cycle.outgoing_exchanges],
function(exchanges) {
for(var i=0; i < exchanges.length; i++) {
if(!exchanges[i].active) {
exchanges.splice(i, 1);
i--;
}
}
});
}
};
}).