Table elements, too
Last fixup for the sanitizer tests.
This commit is contained in:
parent
6b2ec7354b
commit
a6cbf38304
13
vendor/plugins/HTML5lib/tests/test_sanitizer.rb
vendored
13
vendor/plugins/HTML5lib/tests/test_sanitizer.rb
vendored
|
@ -42,14 +42,23 @@ class SanitizeTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
HTMLSanitizer::ALLOWED_ELEMENTS.each do |tag_name|
|
HTMLSanitizer::ALLOWED_ELEMENTS.each do |tag_name|
|
||||||
next if %w[caption col colgroup optgroup option table tbody td tfoot th thead tr].include?(tag_name) ### TODO
|
|
||||||
define_method "test_should_allow_#{tag_name}_tag" do
|
define_method "test_should_allow_#{tag_name}_tag" do
|
||||||
input = "<#{tag_name} title='1'>foo <bad>bar</bad> baz</#{tag_name}>"
|
input = "<#{tag_name} title='1'>foo <bad>bar</bad> baz</#{tag_name}>"
|
||||||
htmloutput = "<#{tag_name.downcase} title='1'>foo <bad>bar</bad> baz</#{tag_name.downcase}>"
|
htmloutput = "<#{tag_name.downcase} title='1'>foo <bad>bar</bad> baz</#{tag_name.downcase}>"
|
||||||
xhtmloutput = "<#{tag_name} title='1'>foo <bad>bar</bad> baz</#{tag_name}>"
|
xhtmloutput = "<#{tag_name} title='1'>foo <bad>bar</bad> baz</#{tag_name}>"
|
||||||
rexmloutput = xhtmloutput
|
rexmloutput = xhtmloutput
|
||||||
|
|
||||||
if tag_name == 'image'
|
if %w[caption colgroup optgroup option tbody td tfoot th thead tr].include?(tag_name)
|
||||||
|
htmloutput = "foo <bad>bar</bad> baz"
|
||||||
|
xhtmloutput = htmloutput
|
||||||
|
elsif tag_name == 'col'
|
||||||
|
htmloutput = "foo <bad>bar</bad> baz"
|
||||||
|
xhtmloutput = htmloutput
|
||||||
|
rexmloutput = "<col title='1' />"
|
||||||
|
elsif tag_name == 'table'
|
||||||
|
htmloutput = "foo <bad>bar</bad>baz<table title='1'> </table>"
|
||||||
|
xhtmloutput = htmloutput
|
||||||
|
elsif tag_name == 'image'
|
||||||
htmloutput = "<img title='1'/>foo <bad>bar</bad> baz"
|
htmloutput = "<img title='1'/>foo <bad>bar</bad> baz"
|
||||||
xhtmloutput = htmloutput
|
xhtmloutput = htmloutput
|
||||||
rexmloutput = "<image title='1'>foo <bad>bar</bad> baz</image>"
|
rexmloutput = "<image title='1'>foo <bad>bar</bad> baz</image>"
|
||||||
|
|
Loading…
Reference in a new issue