Testing Filters

Testing your custom filters in AngularJS can be very simple if you keep them straightforward. To illustrate this, consider the following custom filter and test:

myModule.filter('nospace', function() {
  return function(text){
    return text.replace(' ', ''),
  }
});
var nospace = $filter('nospace'),
expect(nospace('my words')).toEqual('mywords'),

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset