2019-05-13 12:44:06 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "application_system_test_case"
|
|
|
|
|
|
|
|
class ActionText::SystemTestHelperTest < ApplicationSystemTestCase
|
|
|
|
test "filling in a rich-text area by ID" do
|
|
|
|
visit new_message_url
|
|
|
|
assert_selector "trix-editor#message_content"
|
|
|
|
fill_in_rich_text_area "message_content", with: "Hello world!"
|
|
|
|
assert_selector :field, "message[content]", with: /Hello world!/, type: "hidden"
|
|
|
|
end
|
|
|
|
|
|
|
|
test "filling in a rich-text area by placeholder" do
|
|
|
|
visit new_message_url
|
|
|
|
assert_selector "trix-editor[placeholder='Your message here']"
|
|
|
|
fill_in_rich_text_area "Your message here", with: "Hello world!"
|
|
|
|
assert_selector :field, "message[content]", with: /Hello world!/, type: "hidden"
|
|
|
|
end
|
|
|
|
|
|
|
|
test "filling in a rich-text area by aria-label" do
|
|
|
|
visit new_message_url
|
2020-02-22 12:20:23 -05:00
|
|
|
assert_selector "trix-editor[aria-label='Message content aria-label']"
|
|
|
|
fill_in_rich_text_area "Message content aria-label", with: "Hello world!"
|
|
|
|
assert_selector :field, "message[content]", with: /Hello world!/, type: "hidden"
|
|
|
|
end
|
|
|
|
|
|
|
|
test "filling in a rich-text area by label" do
|
|
|
|
visit new_message_url
|
|
|
|
assert_selector "label", text: "Message content label"
|
|
|
|
fill_in_rich_text_area "Message content label", with: "Hello world!"
|
2019-05-13 12:44:06 -04:00
|
|
|
assert_selector :field, "message[content]", with: /Hello world!/, type: "hidden"
|
|
|
|
end
|
|
|
|
|
|
|
|
test "filling in a rich-text area by input name" do
|
|
|
|
visit new_message_url
|
|
|
|
assert_selector "trix-editor[input]"
|
|
|
|
fill_in_rich_text_area "message[content]", with: "Hello world!"
|
|
|
|
assert_selector :field, "message[content]", with: /Hello world!/, type: "hidden"
|
|
|
|
end
|
2019-05-19 01:54:08 -04:00
|
|
|
|
2019-05-20 13:58:51 -04:00
|
|
|
test "filling in the only rich-text area" do
|
2019-05-19 01:54:08 -04:00
|
|
|
visit new_message_url
|
|
|
|
fill_in_rich_text_area with: "Hello world!"
|
|
|
|
assert_selector :field, "message[content]", with: /Hello world!/, type: "hidden"
|
|
|
|
end
|
2019-05-13 12:44:06 -04:00
|
|
|
end
|