Sha256: 539a38ad63dca44d4ad5ad688d58e62cd92a0593aa99c9cc601bb4ebc6244505

Contents?: true

Size: 769 Bytes

Versions: 7

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
def fill_autocomplete(field, options = {})
  fill_in field, with: options[:with]
  page.execute_script %{ $('##{field}').trigger('focus') }
  page.execute_script %{ $('##{field}').trigger('keydown') }

  selector = %{ul.ui-autocomplete li.ui-menu-item a:contains("#{options[:select]}")}
  sleep(1)
  expect(page).to have_selector('ul.ui-autocomplete li.ui-menu-item a')
  page.execute_script %{ $('#{selector}').trigger('mouseenter').click() }
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fat_free_crm-0.20.1 spec/features/support/autocomlete_helper.rb
fat_free_crm-0.20.0 spec/features/support/autocomlete_helper.rb
fat_free_crm-0.19.2 spec/features/support/autocomlete_helper.rb
fat_free_crm-0.19.0 spec/features/support/autocomlete_helper.rb
fat_free_crm-0.18.2 spec/features/support/autocomlete_helper.rb
fat_free_crm-0.18.1 spec/features/support/autocomlete_helper.rb
fat_free_crm-0.18.0 spec/features/support/autocomlete_helper.rb