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 data attribute in layout generator template #216

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def view_template(&block)
meta name: "viewport", content: "width=device-width,initial-scale=1"
csp_meta_tag
csrf_meta_tags
stylesheet_link_tag "application", data_turbo_track: "reload"
stylesheet_link_tag "application", data: { turbo_track: "reload" }
javascript_importmap_tags
end

Expand Down
2 changes: 1 addition & 1 deletion test/dummy/app/views/layouts/application_layout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def view_template(&block)
meta name: "viewport", content: "width=device-width,initial-scale=1"
csp_meta_tag
csrf_meta_tags
stylesheet_link_tag "application", data_turbo_track: "reload"
stylesheet_link_tag "application", data: { turbo_track: "reload" }
end

body(class: tokens(-> { @color == :blue } => { then: "bg-blue", else: "bg-black" })) do
Expand Down
2 changes: 2 additions & 0 deletions test/phlex/layout_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ class LayoutTest < ActionDispatch::IntegrationTest
get "/layout/with_erb_view"
assert_response :success
assert_select "body.bg-blue"
assert_select "link[rel=stylesheet][data-turbo-track=reload]"
assert_select "title", "ERB View"
assert_select "h1", "Hello from ERB"
end

test "with phlex view" do
get "/layout/with_phlex_view"
assert_response :success
assert_select "link[rel=stylesheet][data-turbo-track=reload]"
assert_select "title", "Phlex View"
assert_select "h1", "Hello from Phlex"
end
Expand Down
Loading