Add tests of HTML sanitization

This commit is contained in:
Andrew Kvalheim 2023-03-03 16:50:20 -08:00
parent 097470bb0c
commit c54a8a1238

View file

@ -16,5 +16,13 @@ describe FormatHelper, type: :helper do
it 'should return HTML for header markdown' do
expect(markdown('# this is my header')).to eq "<h1>this is my header</h1>\n"
end
it 'escapes input HTML' do
expect(markdown('<em>*a*</em>')).to eq "<p>&lt;em&gt;<em>a</em>&lt;/em&gt;</p>\n"
end
it 'removes unallowed elements' do
expect(markdown('<em>*<style>a</style>*</em>', false)).to eq "<p><em><em>a</em></em></p>\n"
end
end
end