Skip to content

Instantly share code, notes, and snippets.

@racheldonovan
Created April 18, 2013 21:55
Show Gist options
  • Save racheldonovan/5416557 to your computer and use it in GitHub Desktop.
Save racheldonovan/5416557 to your computer and use it in GitHub Desktop.
a helper to assit in integration testing (rspec / capybara) wysihtml5 text editors.
module Wysihtml5Helper
def fill_in_wysihtml5(text)
#js must be enabled
page.execute_script("editor.setValue('#{text}')")
end
end
@rfkdali
Copy link

rfkdali commented May 13, 2019

(Thanks to @zedtux) if you got ReferenceError: Can't find variable: editor, you can try this:

page.evaluate_script %{(function() {
  var editor = $('.test-textarea').data("wysihtml5").editor;
  editor.getValue();
  editor.setValue('A text');
})()}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment