Sha256: c31336c600fd5f7dcde3b69eef88e8870bd6c500ce8ce91bd56bcdf3d626447d

Contents?: true

Size: 698 Bytes

Versions: 6

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

Capybara.add_selector(:checkbox, locator_type: [String, Symbol]) do
  xpath do |locator, allow_self: nil, **options|
    xpath = XPath.axis(allow_self ? :"descendant-or-self" : :descendant, :input)[
      XPath.attr(:type) == 'checkbox'
    ]
    locate_field(xpath, locator, options)
  end

  filter_set(:_field, %i[checked unchecked disabled name])

  node_filter(:option) do |node, value|
    val = node.value
    (val == value.to_s).tap do |res|
      add_error("Expected option value to be #{value.inspect} but it was #{val.inspect}") unless res
    end
  end

  describe_node_filters do |option: nil, **|
    " with value #{option.inspect}" if option
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
capybara-3.21.0 lib/capybara/selector/definition/checkbox.rb
capybara-3.20.2 lib/capybara/selector/definition/checkbox.rb
capybara-3.20.1 lib/capybara/selector/definition/checkbox.rb
capybara-3.20.0 lib/capybara/selector/definition/checkbox.rb
capybara-3.19.1 lib/capybara/selector/definition/checkbox.rb
capybara-3.19.0 lib/capybara/selector/definition/checkbox.rb