aboutsummaryrefslogtreecommitdiffstats
path: root/actiontext/test/system
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2019-05-13 12:44:06 -0400
committerGitHub <noreply@github.com>2019-05-13 12:44:06 -0400
commitb2b634137402a82a7dfd60b5646dbd0860a822ca (patch)
tree77d0bd00cc06b58aa08f61e7d5401ac67ab35677 /actiontext/test/system
parent93ef75615e9aec522ee7478689fc6a6ed420814d (diff)
downloadrails-b2b634137402a82a7dfd60b5646dbd0860a822ca.tar.gz
rails-b2b634137402a82a7dfd60b5646dbd0860a822ca.tar.bz2
rails-b2b634137402a82a7dfd60b5646dbd0860a822ca.zip
Add ActionDispatch::SystemTestCase#fill_in_rich_text_area
Diffstat (limited to 'actiontext/test/system')
-rw-r--r--actiontext/test/system/system_test_helper_test.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/actiontext/test/system/system_test_helper_test.rb b/actiontext/test/system/system_test_helper_test.rb
new file mode 100644
index 0000000000..b00bbafa74
--- /dev/null
+++ b/actiontext/test/system/system_test_helper_test.rb
@@ -0,0 +1,33 @@
+# 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
+ assert_selector "trix-editor[aria-label='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 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
+end