-
-
Save zedtux/019927fc8fd4d29572f06375dc15928d to your computer and use it in GitHub Desktop.
A Capybara helper to fill in WYSIHTML5 editors. Works with multiple editors on a page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FillInWysihtml5Helpers | |
def fill_in_wysihtml5(label, options = {}) | |
page.execute_script <<-JAVASCRIPT | |
var id = $("label:contains(#{label})").attr("for"); | |
$("#" + id).data("wysihtml5").editor.setValue("#{options[:with]}"); | |
JAVASCRIPT | |
end | |
def read_wysihtml5(label) | |
page.execute_script <<-JAVASCRIPT | |
var id = $("label:contains(#{label})").attr("for"); | |
$("#" + id).data("wysihtml5").editor.getValue(); | |
JAVASCRIPT | |
end | |
end | |
World(FillInWysihtml5Helpers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment