Module: BestInPlaceishish::TestHelpers

Defined in:
lib/best_in_placeish/test_helpers.rb

Instance Method Summary collapse

Instance Method Details

#bip_area(model, attr, new_value) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/best_in_placeish/test_helpers.rb', line 4

def bip_area(model, attr, new_value)
  id = BestInPlaceishish::Utils.build_best_in_placeish_id model, attr
  page.execute_script "    $(\"#\#{id}\").click();\n    $(\"#\#{id} form textarea\").val('\#{new_value}');\n    $(\"#\#{id} form textarea\").blur();\n  JS\nend\n"

#bip_bool(model, attr) ⇒ Object



22
23
24
25
# File 'lib/best_in_placeish/test_helpers.rb', line 22

def bip_bool(model, attr)
  id = BestInPlaceish::Utils.build_best_in_placeish_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_placeish/test_helpers.rb', line 27

def bip_select(model, attr, name)
  id = BestInPlaceish::Utils.build_best_in_placeish_id model, attr
  page.execute_script "    (function() {\n      $(\"#\#{id}\").click();\n      var opt_value = $(\"#\#{id} select option:contains('\#{name}')\").attr('value');\n      $(\"#\#{id} select option[value='\" + opt_value + \"']\").attr('selected', true);\n      $(\"#\#{id} select\").change();\n    })();\n  JS\nend\n"

#bip_text(model, attr, new_value) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/best_in_placeish/test_helpers.rb', line 13

def bip_text(model, attr, new_value)
  id = BestInPlaceish::Utils.build_best_in_placeish_id model, attr
  page.execute_script "    $(\"#\#{id}\").click();\n    $(\"#\#{id} input[name='\#{attr}']\").val('\#{new_value}');\n    $(\"#\#{id} form\").submit();\n  JS\nend\n"