提交 930f3365 编写于 作者: J Jamis Buck

Updated html-scanner so that assert_tag(:tag => "p", :content => "foo") behaves as expected


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 117ee110
......@@ -115,7 +115,7 @@
* Support :render option for :verify #1440 [TobiasLuetke]
* Updated vendor copy of html-scanner lib to 0.5.1, for bug fixes and optimizations
* Updated vendor copy of html-scanner lib to 0.5.2, for bug fixes and optimizations. The :content option may be used as expected--to find a tag whose textual content is a particular value--in assert_tag, now.
* Changed test requests to come from 0.0.0.0 instead of 127.0.0.1 such that they don't trigger debugging screens on exceptions, but instead call rescue_action_in_public
......
......@@ -191,8 +191,9 @@ def assert_routing(path, options, defaults={}, extras={}, message=nil)
# * <tt>:only</tt>: another hash consisting of the keys to use
# to match on the children, and only matching children will be
# counted.
# * <tt>:content</tt>: (text nodes only). The content of the node must
# match the given value.
# * <tt>:content</tt>: the textual content of the node must match the
# given value. This will not match HTML tags in the body of a
# tag--only text.
#
# Conditions are matched using the following algorithm:
#
......
......@@ -379,9 +379,9 @@ def tag?
# :child => /hello world/ }
def match(conditions)
conditions = validate_conditions(conditions)
# only Text nodes have content
return false if conditions[:content]
# check content of child nodes
return false unless children.find { |child| child.match(conditions[:content]) } if conditions[:content]
# test the name
return false unless match_condition(@name, conditions[:tag]) if conditions[:tag]
......
......@@ -3,7 +3,7 @@ module Version #:nodoc:
MAJOR = 0
MINOR = 5
TINY = 1
TINY = 2
STRING = [ MAJOR, MINOR, TINY ].join(".")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册