mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 20:12:19 +00:00
* Added a task to Gruntfile to use website/src/i18n.js to generate a small JS file to be loaded in Karma env which sets window.env.translations to the i18n.translations['en']. * Added new Grunt task to build:dev * Updated Karma specs to reenable testing where possible, updating comments where not.
27 lines
787 B
JavaScript
27 lines
787 B
JavaScript
'use strict';
|
|
|
|
describe('Filters Controller', function() {
|
|
var scope, user;
|
|
|
|
beforeEach(inject(function($rootScope, $controller, Shared) {
|
|
user = specHelper.newUser();
|
|
Shared.wrap(user);
|
|
scope = $rootScope.$new();
|
|
$controller('FiltersCtrl', {$scope: scope, User: {user: user}});
|
|
}));
|
|
|
|
it('creates a tag', function(){
|
|
scope.createTag('tagName');
|
|
expect(user.tags).to.have.length(1);
|
|
expect(user.tags[0].name).to.eql('tagName');
|
|
expect(user.tags[0]).to.have.property('id');
|
|
});
|
|
|
|
it('toggles tag filtering', inject(function(Shared){
|
|
var tag = {id: Shared.uuid(), name: 'myTag'};
|
|
scope.toggleFilter(tag);
|
|
expect(user.filters[tag.id]).to.eql(true);
|
|
scope.toggleFilter(tag);
|
|
expect(user.filters[tag.id]).to.eql(false);
|
|
}))
|
|
});
|