mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
refactor: Move order by equipmentment button to top of view
This commit is contained in:
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user