Revert "Revert inventory equipment/gear sorting due to inability to de/equip and maybe performance issues."

This reverts commit 9d50201180.
This commit is contained in:
Blade Barringer
2016-03-17 08:09:18 -05:00
parent 9d50201180
commit c7310b97ec
8 changed files with 120 additions and 31 deletions

View File

@@ -0,0 +1,42 @@
describe('Sortable Inventory Controller', () => {
let scope;
beforeEach(inject(($rootScope, $controller) => {
scope = $rootScope.$new();
$controller('SortableInventoryController', {$scope: scope});
}));
it('defaults scope.order to name', () => {
expect(scope.order).to.eql('text()')
});
describe('#setOrder', () => {
it('sets sort criteria for all standard attributes', () =>{
let oldOrder = scope.order;
let attrs = [
'constitution',
'intelligence',
'perception',
'strength',
'name',
'set'
];
attrs.forEach((attribute) => {
scope.setOrder(attribute);
expect(scope.order).to.exist;
expect(scope.order).to.not.eql(oldOrder);
oldOrder = scope.order;
});
});
it('does nothing when missing sort criteria', () =>{
scope.order = null;
scope.setOrder('foooo');
expect(scope.order).to.not.exist;
});
});
});