Method: Mache::DSL::ClassMethods#element

Defined in:
lib/mache/dsl.rb

#element(name, selector, options = {}) ⇒ Object

Defines an element that wraps an HTML fragment.

Parameters:

  • name (String, Symbol)

    a name for the element

  • selector (String)

    a selector to find the element

  • options (Hash) (defaults to: {})

    a hash of options to pass to the Capybara finder



66
67
68
69
70
71
72
# File 'lib/mache/dsl.rb', line 66

def element(name, selector, options = {})
  define_method(name.to_s) do
    Node.new(node: @node.find(selector, options))
  end

  define_helper_methods(name, selector)
end