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

Fix missing attributes in FormBuilder inputs #144

Merged
merged 5 commits into from
Apr 21, 2023
Merged

Conversation

bennothommo
Copy link
Member

Commit 2ef3234 made some adjustments to the input method arguments that resulted in the some attributes not being populated if the name of the input was not provided. This commit changes the structure of the condition so that these attributes are properly filled in.

I've also redone the tests using some custom assertions so that the order of the attributes does not matter when testing. The previous tests were a bit flimsy in this regard.

Fixes wintercms/winter#864

Commit 2ef3234 made some adjustments to the input method arguments that resulted in the some attributes not being populated if the name of the input was not provided. This commit changes the structure of the condition so that these attributes are properly filled in.

I've also redone the tests using some custom assertions so that the order of the attributes does not matter when testing. The previous tests were a bit flimsy in this regard.

Fixes wintercms/winter#864
@what-the-diff
Copy link

what-the-diff bot commented Apr 3, 2023

PR Summary

  • Added null coalescing operator to FormBuilder::token()
    Improves code readability and handles null values in a more efficient way.

  • Changed type of $session to allow for nullable types
    Allows for more flexibility in the session handling within the FormBuilder.

  • Removed unused use statement and added Request facade import
    Streamlines dependencies and fixes the import for better code organization.

  • Created AssertHtml trait for easier HTML testing
    Provides new assertions for testing HTML output, improving testing capabilities.

  • Added and improved various tests for FormBuilder
    Enhances test coverage for the FormBuilder, ensuring better functionality and reliability.

  • Fixed ID attribute issue with inputs and labels
    Resolves a problem where the ID attribute was inconsistently set, improving form accessibility and structure.

  • Created submit() and button() methods in FormBuilder
    Adds missing functionality to FormBuilder, enabling its usage in other systems like OctoberCMS, and achieving parity between frameworks.

Copy link
Member

@mjauvin mjauvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on the AssertHtml trait @bennothommo!

Just a few things I noticed in the new test cases.

src/Html/FormBuilder.php Show resolved Hide resolved
src/Html/FormBuilder.php Outdated Show resolved Hide resolved
tests/Html/FormBuilderTest.php Show resolved Hide resolved
@bennothommo
Copy link
Member Author

Thanks for reviewing @mjauvin :)

Copy link
Member

@mjauvin mjauvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, with all those amazing tests!

@LukeTowers LukeTowers merged commit 9e0508c into develop Apr 21, 2023
@LukeTowers LukeTowers deleted the fix/winter-864 branch April 21, 2023 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants