Sha256: 6d18c206eeb3115c6b704e3fbc8148c3ef9bd7812e3fd4f94a56fc26697ca1b3

Contents?: true

Size: 1.06 KB

Versions: 47

Compression:

Stored size: 1.06 KB

Contents

module HtmlSelectorsHelpers
  # Maps a name to a selector. Used primarily by the
  #
  #   When /^(.+) within (.+)$/ do |step, scope|
  #
  # step definitions in web_steps.rb
  #
  def selector_for(locator)
    case locator

    when "the page"
      "html > body"

    # Add more mappings here.
    # Here is an example that pulls values out of the Regexp:
    #
    #  when /^the (notice|error|info) flash$/
    #    ".flash.#{$1}"

    # You can also return an array to use a different selector
    # type, like:
    #
    #  when /the header/
    #    [:xpath, "//header"]

    when "index grid"
      [:css, "table.index_grid"]

    when /^the "([^"]*)" sidebar$/
      [:css, "##{$1.tr(" ", '').underscore}_sidebar_section"]

    # This allows you to provide a quoted selector as the scope
    # for "within" steps as was previously the default for the
    # web steps:
    when /^"(.+)"$/
      $1

    else
      raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
        "Now, go and add a mapping in #{__FILE__}"
    end
  end
end

World(HtmlSelectorsHelpers)

Version data entries

47 entries across 47 versions & 6 rubygems

Version Path
activeadmin-rails-1.7.2 features/support/selectors.rb
activeadmin-rails-1.7.1 features/support/selectors.rb
activeadmin-rails-1.7.0 features/support/selectors.rb
activeadmin-rb-1.6.0 features/support/selectors.rb
activeadmin-rb-1.5.2 features/support/selectors.rb
activeadmin-rb-1.5.1 features/support/selectors.rb
activeadmin-rb-1.5.0 features/support/selectors.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/features/support/selectors.rb
activeadmin-rb-1.4.0 features/support/selectors.rb
activeadmin_addons-1.7.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/features/support/selectors.rb
activeadmin-1.3.1 features/support/selectors.rb
activeadmin_addons-1.6.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/features/support/selectors.rb
activeadmin_addons-1.5.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/features/support/selectors.rb
activeadmin-1.3.0 features/support/selectors.rb
activeadmin_addons-1.4.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/features/support/selectors.rb
activeadmin_addons-1.3.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/features/support/selectors.rb
activeadmin_addons-1.2.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/features/support/selectors.rb
activeadmin-1.2.1 features/support/selectors.rb
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/features/support/selectors.rb
activeadmin-1.2.0 features/support/selectors.rb