Adjust PR #5389
* Convert $watch to ng-change and re-wrote test * Removed unnecessary styles * Use .form-control instead of class='form-control'
This commit is contained in:
@@ -10,28 +10,30 @@ describe('Filters Controller', function() {
|
||||
$controller('FiltersCtrl', {$scope: scope, User: {user: user}});
|
||||
}));
|
||||
|
||||
it('creates a tag', function(){
|
||||
scope._newTag = {name:'tagName'}
|
||||
scope.createTag();
|
||||
expect(user.tags).to.have.length(1);
|
||||
expect(user.tags[0].name).to.eql('tagName');
|
||||
expect(user.tags[0]).to.have.property('id');
|
||||
describe('tags', function(){
|
||||
it('creates a tag', function(){
|
||||
scope._newTag = {name:'tagName'}
|
||||
scope.createTag();
|
||||
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);
|
||||
}));
|
||||
});
|
||||
|
||||
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);
|
||||
}));
|
||||
describe('updateTaskFilter', function(){
|
||||
it('updatest user\'s filter query with the value of filterQuery', function () {
|
||||
scope.filterQuery = 'task';
|
||||
scope.updateTaskFilter();
|
||||
|
||||
it('updates user\'s filter query when filterQuery is changed', function () {
|
||||
scope.$apply();
|
||||
|
||||
scope.filterQuery = 'foo';
|
||||
scope.$apply();
|
||||
|
||||
expect(user.filterQuery).to.eql('foo');
|
||||
expect(user.filterQuery).to.eql(scope.filterQuery);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user