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