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:
Andrew Bloomgarden
2014-01-12 15:05:15 -08:00
parent 77801e458e
commit dc368bb652
14 changed files with 65 additions and 58 deletions

View File

@@ -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);
})
});
}))
});