sgruhier / foundation_rails_helper

Rails Helper for Zurb Fondation framework
MIT License
153 stars 83 forks source link

Allow overriding the autocomplete attribute on `password_field` #185

Open Quentinchampenois opened 2 years ago

Quentinchampenois commented 2 years ago

Description

This PR allows to override the autocomplete attribute default value on the password_field.

Also, this PR contains a light refactor on the autocomplete default value for the time_zone_select, date_select, datetime_select to be homogeneous with fields select, collection_select and grouped_collection_select

Done

Resources

Additional informations

Thanks for this project ! I remain available for any questions.

Quentinchampenois commented 2 years ago

Hello, I have some rubocop offenses on my branch and I wonder how you prefer to proceed ?

Rubocop output :

spec/foundation_rails_helper/form_builder_spec.rb:292:81: C: Line is too long. [93/80]
          .to have_css('input[type="password"][name="author[password]"][autocomplete="off"]')
                                                                                ^^^^^^^^^^^^^
spec/foundation_rails_helper/form_builder_spec.rb:306:81: C: Line is too long. [104/80]
            .to have_css('input[type="password"][name="author[password]"][autocomplete="new-password"]')
                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^
spec/foundation_rails_helper/form_builder_spec.rb:486:81: C: Line is too long. [97/80]
          expect(node).to have_css("select[name='author[birthdate(#{i}i)]'][autocomplete='off']")
                                                                                ^^^^^^^^^^^^^^^^^
spec/foundation_rails_helper/form_builder_spec.rb:537:81: C: Line is too long. [97/80]
          expect(node).to have_css("select[name='author[birthdate(#{i}i)]'][autocomplete='off']")
                                                                                ^^^^^^^^^^^^^^^^^
spec/foundation_rails_helper/form_builder_spec.rb:577:81: C: Line is too long. [88/80]
        expect(node).to have_css('select[name="author[time_zone]"][autocomplete="off"]')
                                                                                ^^^^^^^^
lib/foundation_rails_helper/form_builder.rb:5:3: C: Class has too many lines. [185/183]
  class FormBuilder < ActionView::Helpers::FormBuilder ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

19 files inspected, 6 offenses detected

Would you prefer to inline disable the offenses in specs, or maybe move the content of have_css method in a dedicated variable ?

For the number of line in the FormBuilder class, I don't see solution except increase the number of lines in the class

Thanks !