Module: BestInPlaceMongoid::TestHelpers
- Defined in:
- lib/best_in_place_mongoid/test_helpers.rb
Instance Method Summary collapse
- #bip_area(model, attr, new_value) ⇒ Object
- #bip_bool(model, attr) ⇒ Object
- #bip_select(model, attr, name) ⇒ Object
- #bip_text(model, attr, new_value) ⇒ Object
Instance Method Details
#bip_area(model, attr, new_value) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/best_in_place_mongoid/test_helpers.rb', line 4 def bip_area(model, attr, new_value) id = BestInPlaceMongoid::Utils.build_best_in_place_id model, attr page.execute_script <<-JS $("##{id}").click(); $("##{id} form textarea").val('#{new_value}'); $("##{id} form textarea").blur(); JS end |
#bip_bool(model, attr) ⇒ Object
22 23 24 25 |
# File 'lib/best_in_place_mongoid/test_helpers.rb', line 22 def bip_bool(model, attr) id = BestInPlaceMongoid::Utils.build_best_in_place_id model, attr page.execute_script("$('##{id}').click();") end |
#bip_select(model, attr, name) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/best_in_place_mongoid/test_helpers.rb', line 27 def bip_select(model, attr, name) id = BestInPlaceMongoid::Utils.build_best_in_place_id model, attr page.execute_script <<-JS (function() { $("##{id}").click(); var opt_value = $("##{id} select option:contains('#{name}')").attr('value'); $("##{id} select option[value='" + opt_value + "']").attr('selected', true); $("##{id} select").change(); })(); JS end |
#bip_text(model, attr, new_value) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/best_in_place_mongoid/test_helpers.rb', line 13 def bip_text(model, attr, new_value) id = BestInPlaceMongoid::Utils.build_best_in_place_id model, attr page.execute_script <<-JS $("##{id}").click(); $("##{id} input[name='#{attr}']").val('#{new_value}'); $("##{id} form").submit(); JS end |