mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Explicit delegation instead of blanket forward
This commit is contained in:
parent
191e9ba815
commit
787405be40
2 changed files with 30 additions and 5 deletions
|
@ -55,6 +55,12 @@ module Capybara
|
|||
def trigger(event)
|
||||
raise NotSupportedByDriverError
|
||||
end
|
||||
|
||||
def inspect
|
||||
%(#<Capybara::Driver::Node tag="#{tag_name}" path="#{path}">)
|
||||
rescue NotSupportedByDriverError
|
||||
%(#<Capybara::Driver::Node tag="#{tag_name}">)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,16 +23,35 @@ module Capybara
|
|||
end
|
||||
|
||||
class Element < Node
|
||||
# TODO: maybe we should explicitely delegate?
|
||||
def method_missing(*args)
|
||||
@base.send(*args)
|
||||
extend Forwardable
|
||||
|
||||
def_delegator :base, :text
|
||||
def_delegator :base, :[]
|
||||
def_delegator :base, :value
|
||||
def_delegator :base, :set
|
||||
def_delegator :base, :select_option
|
||||
def_delegator :base, :unselect_option
|
||||
def_delegator :base, :click
|
||||
def_delegator :base, :tag_name
|
||||
def_delegator :base, :visible?
|
||||
def_delegator :base, :path
|
||||
def_delegator :base, :trigger
|
||||
|
||||
def drag_to(node)
|
||||
base.drag_to(node.base)
|
||||
end
|
||||
|
||||
def respond_to?(method)
|
||||
super || @base.respond_to?(method)
|
||||
def inspect
|
||||
%(#<Capybara::Element tag="#{tag_name}" path="#{path}">)
|
||||
rescue NotSupportedByDriverError
|
||||
%(#<Capybara::Element tag="#{tag_name}">)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Document < Node
|
||||
def inspect
|
||||
%(#<Capybara::Document>)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue