Sha256: a230a090feca917cec78c572e4f3d2f56d583babd8c0cf213ff4b67e2240c033

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module Capybara
  module ActiveAdmin
    module Selectors
      module Form
        # @param name [String] form model name
        def form_selector(name)
          "form.formtastic.#{name}"
        end

        def label_selector
          'label.label'
        end

        def inline_error_selector
          'p.inline-errors'
        end

        def semantic_error_selector
          'ul.errors > li'
        end

        def has_many_fields_selector(association_name)
          "div.has_many_container.#{association_name} > fieldset.inputs.has_many_fields"
        end

        def form_submit_selector(value = nil)
          selector = %(input[type="submit"])
          selector += %([value="#{value}"]) unless value.nil?
          selector
        end

        def input_container_selector(label, exact: nil)
          return 'li' if label.nil?

          label_opts = Util.options_with_text(label, exact: exact)
          label_node = find(label_selector, label_opts)
          li_id = label_node.ancestor('li')[:id]
          "li##{li_id}"
        end

        def filter_form_selector
          '.filter_form'
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara_active_admin-0.3.1 lib/capybara/active_admin/selectors/form.rb