refactor: Move order by equipmentment button to top of view

This commit is contained in:
Blade Barringer
2016-03-14 22:20:22 -05:00
parent a6fb945120
commit 9508ed45df
4 changed files with 72 additions and 59 deletions

View File

@@ -1,32 +1,42 @@
'use strict';
describe('Sortable Inventory Controller', () => {
let scope;
describe('Sortable Inventory Controller', function() {
var scope;
beforeEach(inject(function($rootScope, $controller) {
beforeEach(inject(($rootScope, $controller) => {
scope = $rootScope.$new();
$controller('SortableInventoryController', {$scope: scope});
}));
it('has no default sort order', function(){
expect(scope.order).to.not.exist;
it('defaults scope.order to name', () => {
expect(scope.order).to.eql('text()')
});
it('sets sort criteria for all standard attributes', function(){
var oldOrder = scope.order;
describe('#setOrder', () => {
it('sets sort criteria for all standard attributes', () =>{
let oldOrder = scope.order;
var attrs = ['con', 'int', 'per', 'str', 'name', 'set'];
let attrs = [
'constitution',
'intelligence',
'perception',
'strength',
'name',
'set'
];
attrs.forEach(function (attribute) {
scope.setOrder(attribute);
expect(scope.order).to.exist;
expect(scope.order).to.not.eql(oldOrder);
oldOrder = scope.order;
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;
});
});
it('does nothing when missing sort criteria', function(){
scope.setOrder('foooo');
expect(scope.order).to.not.exist;
});
});