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