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-20 13:15:50 -05:00
|
|
|
var sanitized = sanitizeHtml("<div><script>alert('hi');</script></div>");
|
2013-02-19 23:37:42 -05:00
|
|
|
|
|
|
|
expect(sanitized)
|
|
|
|
.toBe("<div></div>");
|
|
|
|
});
|
|
|
|
|
|
|
|
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-19 23:37:42 -05:00
|
|
|
|
|
|
|
expect(sanitized)
|
|
|
|
.toBe("<div><p class=\"funky\">hello</p></div>");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|