Refactoring SelectOption creation
This commit is contained in:
parent
1e7e977ec4
commit
f3ff8d4ad2
@ -365,11 +365,7 @@ module Webrat
|
||||
end
|
||||
|
||||
def options
|
||||
option_elements.map { |oe| SelectOption.new(@session, oe) }
|
||||
end
|
||||
|
||||
def option_elements
|
||||
Webrat::XML.css_search(@element, "option")
|
||||
@options ||= SelectOption.load_all(@session, @element)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -3,6 +3,10 @@ require "webrat/core/elements/element"
|
||||
module Webrat
|
||||
class SelectOption < Element #:nodoc:
|
||||
|
||||
def self.xpath_search
|
||||
".//option"
|
||||
end
|
||||
|
||||
def matches_text?(text)
|
||||
if text.is_a?(Regexp)
|
||||
Webrat::XML.inner_html(@element) =~ text
|
||||
|
Loading…
Reference in New Issue
Block a user