Skip to content

Commit

Permalink
Fix incorrect closing CDATA delimiter. Add tests for CDATA nodes.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information
packagethief authored and jeremy committed Oct 24, 2008
1 parent d1922cc commit 8fad8d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def ==(node)
# itself.
class CDATA < Text #:nodoc:
def to_s
"<![CDATA[#{super}]>"
"<![CDATA[#{super}]]>"
end
end

Expand Down
15 changes: 15 additions & 0 deletions actionpack/test/controller/html-scanner/cdata_node_test.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8fad8d7

Please sign in to comment.