Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding the autocomplete attribute on password_field #185

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Quentinchampenois
Copy link

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

  • Add tests
  • Ensure tests are valids
  • Rubocop linting (See comment below)

Resources

Additional informations

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

@Quentinchampenois
Copy link
Author

Quentinchampenois commented May 17, 2022

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant