Sha256: 5090f2421c234aedc6fec891d67e79c98654720c8c6779be0f88bb98bac2c188

Contents?: true

Size: 651 Bytes

Versions: 4

Compression:

Stored size: 651 Bytes

Contents

class FillIN::JsSelect

  def initialize(label, value, within)
    @label = label
    @value = value
    @within = within || Capybara.current_session
  end

  def call
    locator, index = Locator::Index.execute(@value)
    locator, xpath = Locator::Equal.execute(locator)

    index ||= 1

    input = FillIN::Input.new(@label, locator, @within).call

    Waiter.wait do
      # prev version "(./ancestor::*[#{xpath}][#{index}]/#{xpath})[#{index}]"
      input.find(:xpath, "(./ancestor::*[#{xpath}]/#{xpath})[#{index}]").click
    end

    Pickles.blur(input)

    Waiter.wait_for_ajax

    input
  end

  private

  attr_reader :label, :value

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pickles-0.2.4 lib/cucumber/pickles/steps/fill_in/js_select.rb
pickles-0.2.3 lib/cucumber/pickles/steps/fill_in/js_select.rb
pickles-0.2.2 lib/cucumber/pickles/steps/fill_in/js_select.rb
pickles-0.2.1 lib/cucumber/pickles/steps/fill_in/js_select.rb