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
Add test component for multiple formats support #1070
base: main
Are you sure you want to change the base?
Conversation
2cad89f
to
3c2e90a
Compare
3c2e90a
to
cede0da
Compare
Thanks for adding this test case! We should pair on making it pass
Email me: joelhawksley@github.com
|
|
||
| class ViewComponentMultipleFormatsTest < ViewComponent::TestCase | ||
| def test_render_html | ||
| render_inline(MyComponentMultipleFormat.new, format: :html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the format be set by the request? I'm guessing we'd need to add a with_request_format test helper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I started with a skeleton code/pseudo code.
What I'm thinking to do is:
- check if there is a view for
#{component}.#{format}.#{extension}. if it exists, set it as view.
Co-authored-by: Joel Hawksley <joelhawksley@github.com>
1e58d68
to
5487678
Compare
f6aa825
to
c5a1f3d
Compare
|
@joelhawksley any reason why |
|
@vpereira we are not using the ActionView context as we want to keep ViewComponent templates separate from ActionView. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

As asked by @joelhawksley on issue #1062, I'm opening a PR with a test component with multiple formats (html and text)
Feel free to guide me if something is missing.