Closed oneiros closed 2 months ago
Great PR. I think it would be best to merge this and #38 to update-phlex-22
and test things in that branch before we merge things into main.
Also I would like to start adding support for sinatra and other making this project not completely rails dependent so good catch on the places active support is being used. I don't think we should explicitly add them as requirements to the gemspec but instead document which calls are AS like you did and remove them in the next release preparing for support for sinatra and not making it explicitly rails.
This looks like a good starting place for tests. I'd say fix up those style format warnings to make CI happy.
thats something i am fixing on main right now. Its with an updated version of standard. @mrinterweb
As I wrote in #38 I also started looking into phlex's deprecation of the
#template
method. And I also stumbled upon the missing tests to somehow verify the warning is gone but components still render.So I wanted to add some very simple tests. They are mostly auto-generated and then adjusted manually where necessary.
The tests only try to render the components using defaults where possible or very minimal test parameters where not. Nothing fancy and barely useful, but hopefully better than nothing.
I stumbled upon two problems I had to solve:
phlex_ui
implicitly depends on thejson
andactivesupport
gems. It uses#to_json
in some places and a couple of AS core extensions (Object#present?
,String#underscore
andString#html_safe
). I made these dependencies explicit. Of course, AS is a heavy dependency and it might make sense to think about removing it. But for now I made sure to require only what is needed. And in rails apps it is always there anyway.PhlexUI::Select::Content
had a default value ofnil
for theoutlet_id
parameter, but then goes on to call methods on the value thatnil
does not have. My fix was simply to remove the default.I did not go so far as to add a Github action to run these test automatically. If this is merged, it might make sense to add one. (I might even look into it, but maybe someone here is a little bit more comfortable with GH actions than me and beats me to it :slightly_smiling_face: )