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 options in select tags #6120

Merged

Conversation

chaimann
Copy link
Contributor

@chaimann chaimann commented Feb 13, 2025

Summary

A small improvement on changes from #6091 where in Rails 7 calling tag.method(@tag).parameters.any? { |_type, name| name == :content } would always return false when @tag == :select, since tag.select method's signature has only * (:rest) as its parameter, thus not passing any <option>s for select tag.

Somehow the problem was not being flagged by CI builds, but admin specs failed locally.

Instead, use explicit void elements list to understand whether given element is void, therefore does not accept content.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

A small improvement on changes from solidusio#6091
where in Rails 7 calling `tag.method(@tag).parameters.any? { |_type, name| name == :content }`
would always return false when @tag == :select, since `tag.select` method's
signature has only `*` (:rest) as its parameter, thus not passing any `<option>`s for select tag.

Somehow the problem was not being flagged by CI builds, but admin specs failed locally.

Instead, use explicit void elements list to understand whether given element is void, therefore does not accept `content`.
@chaimann chaimann force-pushed the fix-select-component-missing-content branch from d7746f7 to f3e9082 Compare February 13, 2025 13:23
Copy link

codecov bot commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.63%. Comparing base (95a9ea8) to head (e2b4c05).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6120      +/-   ##
==========================================
- Coverage   88.68%   86.63%   -2.06%     
==========================================
  Files         830      512     -318     
  Lines       18013    11818    -6195     
==========================================
- Hits        15975    10238    -5737     
+ Misses       2038     1580     -458     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chaimann chaimann marked this pull request as ready for review February 13, 2025 13:53
@chaimann chaimann requested a review from a team as a code owner February 13, 2025 13:53
Copy link
Member

@tvdeyen tvdeyen 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! 👏🏻

@tvdeyen tvdeyen added backport-v4.4 Backport this pull-request to v4.4 and removed backport-v4.4 Backport this pull-request to v4.4 labels Feb 14, 2025
@tvdeyen tvdeyen added this to the 4.5 milestone Feb 14, 2025
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Rails really needs to provide a programmatic way to understand the type of tag from withing a Rails application, isn't it?

@kennyadsl kennyadsl merged commit ad4f5be into solidusio:main Feb 14, 2025
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants