Phlex 2.0 alpha is ready for testing ποΈ #769
Replies: 3 comments 19 replies
-
You can now preview the new (incomplete) docs here. https://beta.phlex.fun |
Beta Was this translation helpful? Give feedback.
-
I upgraded my app to Phlex 2.0.0.beta2 and only 3 things made my tests fail: Rendering translations with HTMLThis code: # Before this rendered the correct html
div { t("my_key_html") }
# On Phlex 2.0.0.beta2 this escapes the HTML
div { t("my_key_html") }
# I had to do:
div { safe(t("my_key_html")) } I'm not sure why, the Rendering partials# before
render "my/partial/path"
#after
render partial: "my/partial/path" I think this is fine, but just adding here because it could be added to the upgrading guide. Phlex symbols handling x Turbo symbols handlingI had: # on my controller
turbo_stream.replace(:x_y_z, XYZComponent.new)
# on my view
div id: :x_y_z, ... This rendered |
Beta Was this translation helpful? Give feedback.
-
Is this becuase of phlex 2 or because of something else? Test: RSpec.describe Views::Organizations::Transfers::Show, type: :component do
fixtures :organizations, :accounts, :transfers, :users, :members
let(:organization) { organizations(:zazu) }
let(:user) { users(:alfred) }
let(:member) { members(:zazu_manager_alfred) }
let(:transfer) { transfers(:one) }
let(:accounts) { organization.accounts }
it "displays the transfer details" do
render described_class.new(
member:,
transfer:,
accounts:
)
expect(component).to have_content(transfer.id)
expect(component).to have_content(transfer.amount_currency)
expect(component).to have_content(transfer.to_d.to_s)
expect(component).to have_content(transfer.status)
expect(component).to have_content(transfer.creditor_account.name)
expect(component).to have_content(transfer.debitor_account.name)
expect(component).to have_content(transfer.created_at.rfc3339)
expect(component).to have_link("Back to Transfers", href: organization_transfers_path)
end
end Gives me the following error:
Not sure where to start looking |
Beta Was this translation helpful? Give feedback.
-
The Phlex 2.0 alpha is ready for testing. New draft docs are in
main
here. There are instructions on how to build them in theREADME
. Contributions to this documentation are very welcome. https://github.com/phlex-ruby/phlex.funYou can install the alpha directly from GitHub.
I recommend trying it out in a new Rails app. Youβll need Ruby
3.3.1
or greater. Try the generators, kick the tyres and let us know how you get on.Kits are enabled by default with the new install generator, so you can render components by calling their name as a method, e.g.
Beta Was this translation helpful? Give feedback.
All reactions