Module: CapybaraJsHelpers::SelectizeHelper
- Defined in:
- lib/capybara_js_helpers/selectize_helper.rb
Instance Method Summary collapse
- #selectize_add_item(selector, item_value) ⇒ Object
- #selectize_exec(selector, command) ⇒ Object
- #selectize_remove_item(selector, item_value) ⇒ Object
- #selectize_search(selector, search_term) ⇒ Object
Instance Method Details
#selectize_add_item(selector, item_value) ⇒ Object
3 4 5 |
# File 'lib/capybara_js_helpers/selectize_helper.rb', line 3 def selectize_add_item(selector, item_value) selectize_exec(selector, "addItem('#{item_value}')") end |
#selectize_exec(selector, command) ⇒ Object
16 17 18 |
# File 'lib/capybara_js_helpers/selectize_helper.rb', line 16 def selectize_exec(selector, command) page.execute_script("$('#{selector}')[0].selectize.#{command}") end |
#selectize_remove_item(selector, item_value) ⇒ Object
7 8 9 |
# File 'lib/capybara_js_helpers/selectize_helper.rb', line 7 def selectize_remove_item(selector, item_value) selectize_exec(selector, "removeItem('#{item_value}')") end |
#selectize_search(selector, search_term) ⇒ Object
11 12 13 14 |
# File 'lib/capybara_js_helpers/selectize_helper.rb', line 11 def selectize_search(selector, search_term) selectize_exec(selector, "onSearchChange('#{search_term}')") selectize_exec(selector, "open()") end |