Files
grecia/spec/lib/admin_wysiwyg_sanitizer_spec.rb
dependabot[bot] 83f23b3ef1 Bump rails from 5.2.4.4 to 5.2.4.5
Bumps [rails](https://github.com/rails/rails) from 5.2.4.4 to 5.2.4.5.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](https://github.com/rails/rails/compare/v5.2.4.4...v5.2.4.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-20 20:02:02 +01:00

32 lines
1014 B
Ruby

require "rails_helper"
describe AdminWYSIWYGSanitizer do
let(:sanitizer) { AdminWYSIWYGSanitizer.new }
describe "#sanitize" do
it "allows images" do
html = 'Dangerous<img src="/smile.png" alt="Smile" style="width:10px;"> image'
expect(sanitizer.sanitize(html)).to eq(html)
end
it "allows tables" do
html = '<table align="center" border="2" cellpadding="2" cellspacing="2" dir="ltr" ' \
'id="table_id" class="stylesheet_classes" style="height:200px;width:500px;" ' \
'summary="summary">
<caption>caption</caption>
<tbody>
<tr>
<th scope="row">header 1</th>
<td>cell 1</td>
</tr>
<tr>
<th scope="row">header 2</th>
<td>cell 2</td>
</tr>
</tbody>
</table>'
expect(sanitizer.sanitize(html)).to eq(html)
end
end
end