mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Remove references to $rootScope.Shared & .Content in non-view code.
Instead, have them request services that return them so tests don’t need to prepare special state.
This commit is contained in:
@@ -4,9 +4,9 @@ describe('Filters Controller', function() {
|
||||
var scope, user;
|
||||
|
||||
beforeEach(module('habitrpg'));
|
||||
beforeEach(inject(function($rootScope, $controller) {
|
||||
beforeEach(inject(function($rootScope, $controller, Shared) {
|
||||
user = {filters: {}};
|
||||
window.habitrpgShared.wrap(user);
|
||||
Shared.wrap(user);
|
||||
scope = $rootScope.$new();
|
||||
$controller('FiltersCtrl', {$scope: scope, User: {user: user}});
|
||||
}));
|
||||
@@ -18,11 +18,11 @@ describe('Filters Controller', function() {
|
||||
expect(user.tags[0]).to.have.property('id');
|
||||
});
|
||||
|
||||
it('toggles tag filtering', function(){
|
||||
var tag = {id: window.habitrpgShared.uuid(), name: 'myTag'};
|
||||
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);
|
||||
})
|
||||
});
|
||||
}))
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user