Module: Waterpig::CKEditorTools

Defined in:
lib/waterpig/ckeditor-tools.rb

Instance Method Summary collapse

Instance Method Details

#fill_in_ckeditor(id, options = {}) ⇒ Object


3
4
5
6
7
8
# File 'lib/waterpig/ckeditor-tools.rb', line 3

def fill_in_ckeditor(id, options = {})
  raise "Must pass a hash containing 'with'" if not options.is_a?(Hash) or not options.has_key?(:with)
  raise "CKEeditor fill-in only works with Selenium driver" unless page.driver.class == Capybara::Selenium::Driver
  browser = page.driver.browser
  browser.execute_script("CKEDITOR.instances['#{id}'].setData('#{options[:with]}');")
end