2013-02-20 13:15:50 -05:00
|
|
|
/*global waitsFor:true expect:true describe:true beforeEach:true it:true sanitizeHtml:true */
|
|
|
|
|
2013-02-19 23:37:42 -05:00
|
|
|
describe("sanitize", function(){
|
|
|
|
|
|
|
|
it("strips all script tags", function(){
|
2013-02-25 11:42:20 -05:00
|
|
|
var sanitized = sanitizeHtml("<div><script>alert('hi');</script></div>");
|
2013-02-27 21:26:20 -05:00
|
|
|
expect(sanitized).toBe("<div></div>");
|
2013-02-19 23:37:42 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it("strips disallowed attributes", function(){
|
2013-02-20 13:15:50 -05:00
|
|
|
var sanitized = sanitizeHtml("<div><p class=\"funky\" wrong='1'>hello</p></div>");
|
2013-02-27 21:26:20 -05:00
|
|
|
expect(sanitized).toBe("<div><p class=\"funky\">hello</p></div>");
|
2013-02-19 23:37:42 -05:00
|
|
|
});
|
|
|
|
|
2013-02-27 21:26:20 -05:00
|
|
|
});
|