Simplify select option matching code. Minor behavior change:
Valid: select "Peanut Butter & Jelly" Invalid: select "Peanut Butter & Jelly"
This commit is contained in:
parent
b7ea26841e
commit
00c49a0521
@ -17,6 +17,10 @@ module Webrat
|
||||
select.unset(value)
|
||||
end
|
||||
|
||||
def inner_text
|
||||
@element.inner_text
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def select
|
||||
|
@ -21,7 +21,7 @@ module Webrat
|
||||
if @option_text.is_a?(Regexp)
|
||||
o.element.inner_html =~ @option_text
|
||||
else
|
||||
escaped_or_non_escaped_values.include?(o.element.inner_html)
|
||||
o.inner_text == @option_text.to_s
|
||||
end
|
||||
end
|
||||
else
|
||||
@ -29,7 +29,7 @@ module Webrat
|
||||
if @option_text.is_a?(Regexp)
|
||||
o.inner_html =~ @option_text
|
||||
else
|
||||
escaped_or_non_escaped_values.include?(o.inner_html)
|
||||
o.inner_text == @option_text.to_s
|
||||
end
|
||||
end
|
||||
|
||||
@ -37,10 +37,6 @@ module Webrat
|
||||
end
|
||||
end
|
||||
|
||||
def escaped_or_non_escaped_values
|
||||
[@option_text.to_s, CGI.escapeHTML(@option_text.to_s)]
|
||||
end
|
||||
|
||||
def option_elements
|
||||
@dom.xpath(*SelectOption.xpath_search)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user