Module: Spree::Admin::TestingSupport::TomSelect

Defined in:
lib/spree/admin/testing_support/tom_select.rb

Instance Method Summary collapse

Instance Method Details

#tom_select(value, from:, create: false) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/spree/admin/testing_support/tom_select.rb', line 5

def tom_select(value, from:, create: false)
  fill_in(from, with: value, visible: false)

  if create
    first('.ts-dropdown .ts-dropdown-content .create.active').click
  else
    find('.ts-dropdown .ts-dropdown-content .option', text: /#{Regexp.quote(value)}/i, match: :first).click
  end
end