方法
实例公共方法
fill_in_rich_textarea(locator = nil, with:) 链接
定位一个 Trix 编辑器并用给定的 HTML 填充它。
可以通过以下方式找到编辑器:* 它的 id
* 它的 placeholder
* 来自其 label
元素的文本 * 它的 aria-label
* 其输入的 name
示例
# <trix-editor id="message_content" ...></trix-editor>
fill_in_rich_textarea "message_content", with: "Hello <em>world!</em>"
# <trix-editor placeholder="Your message here" ...></trix-editor>
fill_in_rich_textarea "Your message here", with: "Hello <em>world!</em>"
# <label for="message_content">Message content</label>
# <trix-editor id="message_content" ...></trix-editor>
fill_in_rich_textarea "Message content", with: "Hello <em>world!</em>"
# <trix-editor aria-label="Message content" ...></trix-editor>
fill_in_rich_textarea "Message content", with: "Hello <em>world!</em>"
# <input id="trix_input_1" name="message[content]" type="hidden">
# <trix-editor input="trix_input_1"></trix-editor>
fill_in_rich_textarea "message[content]", with: "Hello <em>world!</em>"
也作为别名:fill_in_rich_text_area
来源:显示 | 在 GitHub 上
# File actiontext/lib/action_text/system_test_helper.rb, line 35 def fill_in_rich_textarea(locator = nil, with:) find(:rich_textarea, locator).execute_script("this.editor.loadHTML(arguments[0])", with.to_s) end