Upgrade to Rails 2.2.0
As a side benefit, fix an (non-user-visible) bug in display_s5(). Also fixed a bug where removing orphaned pages did not expire cached summary pages.
This commit is contained in:
parent
39348c65c2
commit
7600aef48b
827 changed files with 123652 additions and 11027 deletions
15
vendor/rails/actionpack/test/controller/html-scanner/cdata_node_test.rb
vendored
Normal file
15
vendor/rails/actionpack/test/controller/html-scanner/cdata_node_test.rb
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class CDATANodeTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@node = HTML::CDATA.new(nil, 0, 0, "<p>howdy</p>")
|
||||
end
|
||||
|
||||
def test_to_s
|
||||
assert_equal "<![CDATA[<p>howdy</p>]]>", @node.to_s
|
||||
end
|
||||
|
||||
def test_content
|
||||
assert_equal "<p>howdy</p>", @node.content
|
||||
end
|
||||
end
|
|
@ -65,4 +65,25 @@ class NodeTest < Test::Unit::TestCase
|
|||
assert_nothing_raised { node = HTML::Node.parse(nil,0,0,s,false) }
|
||||
assert node.attributes.has_key?("onmouseover")
|
||||
end
|
||||
|
||||
def test_parse_with_valid_cdata_section
|
||||
s = "<![CDATA[<span>contents</span>]]>"
|
||||
node = nil
|
||||
assert_nothing_raised { node = HTML::Node.parse(nil,0,0,s,false) }
|
||||
assert_kind_of HTML::CDATA, node
|
||||
assert_equal '<span>contents</span>', node.content
|
||||
end
|
||||
|
||||
def test_parse_strict_with_unterminated_cdata_section
|
||||
s = "<![CDATA[neverending..."
|
||||
assert_raise(RuntimeError) { HTML::Node.parse(nil,0,0,s) }
|
||||
end
|
||||
|
||||
def test_parse_relaxed_with_unterminated_cdata_section
|
||||
s = "<![CDATA[neverending..."
|
||||
node = nil
|
||||
assert_nothing_raised { node = HTML::Node.parse(nil,0,0,s,false) }
|
||||
assert_kind_of HTML::CDATA, node
|
||||
assert_equal 'neverending...', node.content
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,6 +17,8 @@ class SanitizerTest < Test::Unit::TestCase
|
|||
%{This is a test.\n\n\nIt no longer contains any HTML.\n}, sanitizer.sanitize(
|
||||
%{<title>This is <b>a <a href="" target="_blank">test</a></b>.</title>\n\n<!-- it has a comment -->\n\n<p>It no <b>longer <strong>contains <em>any <strike>HTML</strike></em>.</strong></b></p>\n}))
|
||||
assert_equal "This has a here.", sanitizer.sanitize("This has a <!-- comment --> here.")
|
||||
assert_equal "This has a here.", sanitizer.sanitize("This has a <![CDATA[<section>]]> here.")
|
||||
assert_equal "This has an unclosed ", sanitizer.sanitize("This has an unclosed <![CDATA[<section>]] here...")
|
||||
[nil, '', ' '].each { |blank| assert_equal blank, sanitizer.sanitize(blank) }
|
||||
end
|
||||
|
||||
|
@ -243,6 +245,14 @@ class SanitizerTest < Test::Unit::TestCase
|
|||
assert_sanitized %(<img src='vbscript:msgbox("XSS")' />), '<img />'
|
||||
end
|
||||
|
||||
def test_should_sanitize_cdata_section
|
||||
assert_sanitized "<![CDATA[<span>section</span>]]>", "<![CDATA[<span>section</span>]]>"
|
||||
end
|
||||
|
||||
def test_should_sanitize_unterminated_cdata_section
|
||||
assert_sanitized "<![CDATA[<span>neverending...", "<![CDATA[<span>neverending...]]>"
|
||||
end
|
||||
|
||||
protected
|
||||
def assert_sanitized(input, expected = nil)
|
||||
@sanitizer ||= HTML::WhiteListSanitizer.new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue