Skip to content

Commit

Permalink
Merge pull request #216 from mjankowski/data-turbo-track-style
Browse files Browse the repository at this point in the history
Fix `data` attribute in layout generator template
  • Loading branch information
joeldrapper authored Aug 22, 2024
2 parents d941453 + 32f6b51 commit ebe1226
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
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

0 comments on commit ebe1226

Please sign in to comment.