DavyJonesLocker / client_side_validations

Client Side Validations made easy for Ruby on Rails
MIT License
2.69k stars 405 forks source link

Rails edge compatibility #941

Open tagliala opened 2 months ago

tagliala commented 2 months ago

Steps to reproduce*

Run test suite against rails edge

Expected behavior*

Tests pass

Actual behavior*

Failure:
ClientSideValidations::FormForActionViewHelpersTest#test_http_method [test/action_view/cases/test_form_for_helpers.rb:57]:
Expected: <form action="/posts" accept-charset="UTF-8" method="post" data-client-side-validations="{&quot;html_settings&quot;:{&quot;type&quot;:&quot;ActionView::Helpers::FormBuilder&quot;,&quot;input_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003cspan id=\&quot;input_tag\&quot;\u003e\u003c/span\u003e\u003c/div\u003e&quot;,&quot;label_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003clabel id=\&quot;label_tag\&quot;\u003e\u003c/label\u003e\u003c/div\u003e&quot;},&quot;number_format&quot;:{&quot;separator&quot;:&quot;.&quot;,&quot;delimiter&quot;:&quot;,&quot;},&quot;validators&quot;:{&quot;post[cost]&quot;:{&quot;presence&quot;:[{&quot;message&quot;:&quot;can&#39;t be blank&quot;}]}}}" novalidate="novalidate" id="new_post" class="new_post"><input type="hidden" autocomplete="off" value="patch" name="_method" /><textarea name="post[cost]" id="post_cost">
</textarea></form>
Actual: <form class="new_post" id="new_post" action="/posts" accept-charset="UTF-8" novalidate="novalidate" data-client-side-validations="{&quot;html_settings&quot;:{&quot;type&quot;:&quot;ActionView::Helpers::FormBuilder&quot;,&quot;input_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003cspan id=\&quot;input_tag\&quot;\u003e\u003c/span\u003e\u003c/div\u003e&quot;,&quot;label_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003clabel id=\&quot;label_tag\&quot;\u003e\u003c/label\u003e\u003c/div\u003e&quot;},&quot;number_format&quot;:{&quot;separator&quot;:&quot;.&quot;,&quot;delimiter&quot;:&quot;,&quot;},&quot;validators&quot;:{}}" method="post"><input type="hidden" name="_method" value="patch" autocomplete="off" /><textarea name="post[cost]" id="post_cost">
</textarea></form>

bin/rails test action_view/cases/test_form_for_helpers.rb:46

........................................................................................................................................................................................................................................F

Failure:
ClientSideValidations::FormWithActionViewHelpersTest#test_form_with_text_area [test/action_view/cases/test_form_with_helpers.rb:95]:
Expected: <form action="/posts" accept-charset="UTF-8" method="post" data-client-side-validations="{&quot;html_settings&quot;:{&quot;type&quot;:&quot;ActionView::Helpers::FormBuilder&quot;,&quot;input_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003cspan id=\&quot;input_tag\&quot;\u003e\u003c/span\u003e\u003c/div\u003e&quot;,&quot;label_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003clabel id=\&quot;label_tag\&quot;\u003e\u003c/label\u003e\u003c/div\u003e&quot;},&quot;number_format&quot;:{&quot;separator&quot;:&quot;.&quot;,&quot;delimiter&quot;:&quot;,&quot;},&quot;validators&quot;:{&quot;post[cost]&quot;:{&quot;presence&quot;:[{&quot;message&quot;:&quot;can&#[39](https://github.com/DavyJonesLocker/client_side_validations/actions/runs/10290681313/job/28481203853#step:4:40);t be blank&quot;}]}}}" novalidate="novalidate"><textarea name="post[cost]" id="post_cost">
</textarea></form>
Actual: <form action="/posts" accept-charset="UTF-8" novalidate="novalidate" data-client-side-validations="{&quot;html_settings&quot;:{&quot;type&quot;:&quot;ActionView::Helpers::FormBuilder&quot;,&quot;input_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003cspan id=\&quot;input_tag\&quot;\u003e\u003c/span\u003e\u003c/div\u003e&quot;,&quot;label_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003clabel id=\&quot;label_tag\&quot;\u003e\u003c/label\u003e\u003c/div\u003e&quot;},&quot;number_format&quot;:{&quot;separator&quot;:&quot;.&quot;,&quot;delimiter&quot;:&quot;,&quot;},&quot;validators&quot;:{}}" method="post"><textarea name="post[cost]" id="post_cost">
</textarea></form>

bin/rails test action_view/cases/test_form_with_helpers.rb:85

System configuration*

Rails version: Edge

Ruby version: all compatible

Client Side Validations version: main

Code snippet from your model of the validations*

n/a

The whole form code from your template*

n/a

The resulting HTML*

n/a

Browser's development console output*

Additional JavaScript Libraries*

Repository demostrating the issue

Debugging CSV issues is a time consuming task. If you want to speed up things, please provide a link to a repository showing the issue.


* Failure to include this requirement may result in the issue being closed.

tagliala commented 2 months ago

rails/rails@fa476ce275

rails/rails#52467

Error:
ClientSideValidations::LegacyFormWithActionViewHelpersTest#test_form_with_text_area:
NoMethodError: undefined method `text_area' for an instance of ActionView::Helpers::FormBuilder
    test/action_view/cases/test_legacy_form_with_helpers.rb:26:in `block in test_form_with_text_area'
    /Users/geremia/dev/rails/actionview/lib/action_view/helpers/capture_helper.rb:50:in `block in capture'
    /Users/geremia/dev/rails/actionview/lib/action_view/buffers.rb:75:in `capture'
    /Users/geremia/dev/rails/actionview/lib/action_view/helpers/capture_helper.rb:50:in `capture'
    /Users/geremia/dev/rails/actionview/lib/action_view/helpers/form_helper.rb:775:in `form_with'
    lib/client_side_validations/action_view/form_with_helper.rb:8:in `form_with'
    test/action_view/cases/helper.rb:42:in `form_with'
    test/action_view/cases/test_legacy_form_with_helpers.rb:25:in `test_form_with_text_area'

rails/rails@3278a40d38

F

Failure:
ClientSideValidations::FormWithActionViewHelpersTest#test_form_with_text_area [test/action_view/cases/test_form_with_helpers.rb:95]:
Expected: <form action="/posts" accept-charset="UTF-8" method="post" data-client-side-validations="{&quot;html_settings&quot;:{&quot;type&quot;:&quot;ActionView::Helpers::FormBuilder&quot;,&quot;input_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003cspan id=\&quot;input_tag\&quot;\u003e\u003c/span\u003e\u003c/div\u003e&quot;,&quot;label_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003clabel id=\&quot;label_tag\&quot;\u003e\u003c/label\u003e\u003c/div\u003e&quot;},&quot;number_format&quot;:{&quot;separator&quot;:&quot;.&quot;,&quot;delimiter&quot;:&quot;,&quot;},&quot;validators&quot;:{&quot;post[cost]&quot;:{&quot;presence&quot;:[{&quot;message&quot;:&quot;can&#39;t be blank&quot;}]}}}" novalidate="novalidate"><textarea name="post[cost]" id="post_cost">
</textarea></form>
Actual: <form action="/posts" accept-charset="UTF-8" novalidate="novalidate" data-client-side-validations="{&quot;html_settings&quot;:{&quot;type&quot;:&quot;ActionView::Helpers::FormBuilder&quot;,&quot;input_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003cspan id=\&quot;input_tag\&quot;\u003e\u003c/span\u003e\u003c/div\u003e&quot;,&quot;label_tag&quot;:&quot;\u003cdiv class=\&quot;field_with_errors\&quot;\u003e\u003clabel id=\&quot;label_tag\&quot;\u003e\u003c/label\u003e\u003c/div\u003e&quot;},&quot;number_format&quot;:{&quot;separator&quot;:&quot;.&quot;,&quot;delimiter&quot;:&quot;,&quot;},&quot;validators&quot;:{}}" method="post"><textarea name="post[cost]" id="post_cost">
</textarea></form>
tagliala commented 2 months ago

Difference:

&quot;post[cost]&quot;:{&quot;presence&quot;:[{&quot;message&quot;:&quot;can&#39;t be blank&quot;}]}