83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/waterpig/browser-integration.rb', line 83
def fill_in_tinymce(id, options = {})
content =
case options
when Hash
content = options.fetch(:with)
when String
options
else
raise "Must pass a string or a hash containing 'with'"
end
case page.driver
when Capybara::Selenium::Driver
page.execute_script("$('##{id}').tinymce().setContent('#{content}')")
when Capybara::Poltergeist::Driver
within_frame("#{id}_ifr") do
element = find("body")
element.native.send_keys(content)
end
else
raise "fill_in_tinymce called with unrecognized page.driver: #{page.driver.class.name}"
end
end
|