Sha256: a7b3b035ac0f4af6bb2d62e3fae2fb418aa8701d102e172dfe477572e4be0f91
Contents?: true
Size: 947 Bytes
Versions: 2
Compression:
Stored size: 947 Bytes
Contents
module Polyblock module CapybaraHelpers def fill_in_polyblock(locator, params={}) # Find out ckeditor id at runtime using its label locator = find('label', text: locator)[:for] if page.has_css?('label', text: locator) # Fill the editor content page.execute_script <<-SCRIPT var ckeditor = CKEDITOR.instances['#{locator}']; ckeditor.setData('#{params[:with]}'); ckeditor.focus(); ckeditor.updateElement(); SCRIPT end def fill_in_inline_polyblock(name, params={}) page.execute_script <<-SCRIPT var element = $('.polyblock[data-pbname="#{name}"]'); var ckeditor = CKEDITOR.instances[element.attr('id')]; setTimeout(function(){ ckeditor.fire('focus'); ckeditor.setData('#{params[:with]}'); ckeditor.focus(); ckeditor.updateElement(); }, 1); SCRIPT end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
polyblock-0.9.9 | lib/polyblock/capybara_helpers.rb |
polyblock-0.9.8 | lib/polyblock/capybara_helpers.rb |