Module: CapybaraSelect2::Selectors

Defined in:
lib/capybara_select2/selectors.rb

Constant Summary collapse

OpenerSelectors =
{
  '2' => ".select2-choice, .select2-search-field",
  '3' => ".select2-choice, .select2-search-field",
  '4' => ".select2-selection"
}.freeze
SearchInputSelectors =
{
  '2' => ".select2-dropdown-open input.select2-focused",
  '3' => ".select2-drop-active input.select2-input," +          # single
         ".select2-dropdown-open input.select2-input",          # multi
  '4' => ".select2-container--open input.select2-search__field"
}.freeze
OptionSelectors =
{
  '2' => ".select2-container-active .select2-result",
  '3' => ".select2-drop-active .select2-result-label",
  '4' => ".select2-results .select2-results__option:not([role='group'])"
}.freeze
RemoveOptionSelectors =
{
  '2' => '.select2-search-choice-close',
  '3' => '.select2-search-choice-close',
  '4' => '.select2-selection__choice__remove'
}.freeze

Class Method Summary collapse

Class Method Details

.opener_selector(select2_version) ⇒ Object



12
13
14
# File 'lib/capybara_select2/selectors.rb', line 12

def opener_selector(select2_version)
  OpenerSelectors.fetch(select2_version)
end

.option_selector(select2_version) ⇒ Object



33
34
35
# File 'lib/capybara_select2/selectors.rb', line 33

def option_selector(select2_version)
  OptionSelectors.fetch(select2_version)
end

.remove_option_selector(select2_version) ⇒ Object



43
44
45
# File 'lib/capybara_select2/selectors.rb', line 43

def remove_option_selector(select2_version)
  RemoveOptionSelectors.fetch(select2_version)
end

.search_input_selector(select2_version) ⇒ Object



23
24
25
# File 'lib/capybara_select2/selectors.rb', line 23

def search_input_selector(select2_version)
  SearchInputSelectors.fetch(select2_version)
end