When your filter returns HTML, you need to do stuff for Angular to be OK with it.
Step 1: Tell Angular it’s HTML it can trust:
//some filter code... return $sce.trustAsHtml('html in here');
The $sce service can be injected into your filter like any other Angular service.
Step 2: Test it
describe('some filter tests', function () { beforeEach(module('my module')); var f; beforeEach(inject(function ($filter) { f = $filter('myFilter'); })); describe('Given some thing...', function () { it('should should return me some html', function () { var filterResult = f('some input value').$$unwrapTrustedValue(); expect(filterResult).toBe('<strong>HELLO</strong> <small>little people</small>'); }); }); });