方法
實例公有方法
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>"
來源: 顯示 | 在 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