1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Allow assert_tag(:conditions) to match the empty string when a tag has no children. Closes #2959. [Jamis Buck]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3154 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2005-11-21 21:02:10 +00:00
parent f9b199040c
commit f783d50cf8
3 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Allow assert_tag(:conditions) to match the empty string when a tag has no children. Closes #2959. [Jamis Buck]
* Update html-scanner to handle CDATA sections better. Closes #2970. [Jamis Buck]
* Don't put flash in session if sessions are disabled. [Jeremy Kemper]

View file

@ -412,7 +412,13 @@ module HTML #:nodoc:
conditions = validate_conditions(conditions)
# check content of child nodes
return false unless children.find { |child| child.match(conditions[:content]) } if conditions[:content]
if conditions[:content]
if children.empty?
return false unless match_condition("", conditions[:content])
else
return false unless children.find { |child| child.match(conditions[:content]) }
end
end
# test the name
return false unless match_condition(@name, conditions[:tag]) if conditions[:tag]

View file

@ -3,7 +3,7 @@ module HTML #:nodoc:
MAJOR = 0
MINOR = 5
TINY = 2
TINY = 3
STRING = [ MAJOR, MINOR, TINY ].join(".")