{{ {'name':'value'} | json }}
+ | Filter | +Source | +Rendered | +
| html filter | +
+ <div ng:bind="snippet | html">+ |
+ + + | +
| no filter | +<div ng:bind="snippet"> |
+ + |
| unsafe html filter | +<div ng:bind="snippet | html:'unsafe'"> |
+ + |
an html\nclick here\nsnippet
'); + }); + + it('should escape snippet without any filter', function() { + expect(using('#escaped-html').binding('snippet')). + toBe("<p style=\"color:blue\">an html\n" + + "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" + + "snippet</p>"); + }); + + it('should inline raw snippet if filtered as unsafe', function() { + expect(using('#html-unsafe-filter').binding("snippet | html:'unsafe'")). + toBe("an html\n" + + "click here\n" + + "snippet
"); + }); + + it('should update', function() { + input('snippet').enter('new text'); + expect(using('#html-filter').binding('snippet | html')).toBe('new text'); + expect(using('#escaped-html').binding('snippet')).toBe("new <b>text</b>"); + expect(using('#html-unsafe-filter').binding("snippet | html:'unsafe'")).toBe('new text'); + }); +| Filter | +Source | +Rendered | +
| linky filter | +
+ <div ng:bind="snippet | linky">+ |
+ + + | +
| no filter | +<div ng:bind="snippet"> |
+ + |