aboutsummaryrefslogtreecommitdiffstats
path: root/actiontext/test/system/system_test_helper_test.rb
blob: 2a57fa8d885a39ac77dbd6a19f26f7f554c503ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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

  test "filling in the only rich-text area" do
    visit new_message_url
    fill_in_rich_text_area with: "Hello world!"
    assert_selector :field, "message[content]", with: /Hello world!/, type: "hidden"
  end
end