Sha256: d2279633c35c61ea7b109f23eec555c3b0fd4453109b92804ff7ac00c2163402

Contents?: true

Size: 819 Bytes

Versions: 19

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

module Capybara
  module AutoCompleteJS
    def autocomplete_select(value, from:)
      within("div[data-autocomplete-for='#{from}']") do
        find(".autocomplete-input").click
        find(".autocomplete-input").native.send_keys(value[0..4])
        expect(page).to have_css("#autoComplete_list_1") # select should be open now

        expect(page).to have_css("#autoComplete_result_0", text: value)
        find("#autoComplete_result_0", text: value).hover
        expect(page).to have_css("#autoComplete_result_0", text: value)
        find("#autoComplete_result_0", text: value).click
        expect(page).to have_css(".autocomplete__selected-item", text: value)
      end
    end
  end
end

RSpec.configure do |config|
  config.include Capybara::AutoCompleteJS, type: :system
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-dev-0.28.4 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.9 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.28.3 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.8 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.28.2 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.7 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.28.1 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.6 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.28.0 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.5 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.28.0.rc5 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.28.0.rc4 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.4 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.3 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.2 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.1 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.0 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.0.rc2 lib/decidim/dev/test/rspec_support/autocomplete_select.rb
decidim-dev-0.27.0.rc1 lib/decidim/dev/test/rspec_support/autocomplete_select.rb