diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-10-10 17:00:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-10 17:00:09 -0400 |
commit | a31f691ea9ec973e2d4b4c39c993e4114a7123c3 (patch) | |
tree | 6995810daacfc4242250a24e8ff9535504b54346 | |
parent | 2039da7ba029b2c9889847660aa0ba7c5d25bdc0 (diff) | |
parent | 43a7adb0afd52a83b1d2850c43d007f9a4526034 (diff) | |
download | rails-a31f691ea9ec973e2d4b4c39c993e4114a7123c3.tar.gz rails-a31f691ea9ec973e2d4b4c39c993e4114a7123c3.tar.bz2 rails-a31f691ea9ec973e2d4b4c39c993e4114a7123c3.zip |
Merge pull request #27 from albertoalmagro/test-coverage-form-with-rich-text-area
Add test coverage for form with rich_text_area
-rw-r--r-- | test/template/form_helper_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/template/form_helper_test.rb b/test/template/form_helper_test.rb index d7bdbad26c..18b5edbee5 100644 --- a/test/template/form_helper_test.rb +++ b/test/template/form_helper_test.rb @@ -18,4 +18,32 @@ class ActionText::FormHelperTest < ActionView::TestCase assert_match "message[not_an_attribute]", output_buffer end + + test "form with rich_text_area" do + expected = '<form id="create-message" action="/messages" accept-charset="UTF-8" data-remote="true" method="post">'\ + '<input name="utf8" type="hidden" value="✓" />'\ + '<input type="hidden" name="message[content]" id="message_content_trix_input_message" />'\ + '<trix-editor id="message_content" input="message_content_trix_input_message" class="trix-content" data-direct-upload-url="http://test.host/rails/active_storage/direct_uploads" data-blob-url-template="http://test.host/rails/active_storage/blobs/:signed_id/:filename">'\ + '</trix-editor></form>' + + form_with(model: Message.new, scope: :message, id: "create-message") do |form| + form.rich_text_area(:content) + end + + assert_dom_equal expected, output_buffer + end + + test "form with rich_text_area providing class option" do + expected = '<form id="create-message" action="/messages" accept-charset="UTF-8" data-remote="true" method="post">'\ + '<input name="utf8" type="hidden" value="✓" />'\ + '<input type="hidden" name="message[content]" id="message_content_trix_input_message" />'\ + '<trix-editor id="message_content" input="message_content_trix_input_message" class="custom-class" data-direct-upload-url="http://test.host/rails/active_storage/direct_uploads" data-blob-url-template="http://test.host/rails/active_storage/blobs/:signed_id/:filename">'\ + '</trix-editor></form>' + + form_with(model: Message.new, scope: :message, id: "create-message") do |form| + form.rich_text_area(:content, class: "custom-class") + end + + assert_dom_equal expected, output_buffer + end end |