var sanitize = require('../../../src/core/sanitize'); describe('core/sanitize', function () { describe('.html', function () { describe('when given a HTML', function () { it('should allow safe HTML', function () { expect(sanitize.html('test')).toEqual('test'); expect(sanitize.html('
nono')).toEqual('
nono');
expect(sanitize.html('nono something
', this.optionalSanitizer)).toEqual('optional sanitizer result'); expect(this.optionalSanitizer).toHaveBeenCalled(); expect(this.optionalSanitizer).toHaveBeenCalledWith('something
'); }); }); describe('when given a 2nd param with a non-undefined/function value', function () { it('should skip sanitize', function () { expect(sanitize.html('', false)).toEqual(''); expect(sanitize.html('', null)).toEqual(''); }); }); describe('common XSS attacks', function () { var attacks = [ '