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

Failing test for #580 turbo frame responses missing tracked elements #581

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions test/dummy/app/controllers/tabs_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class TabsController < ApplicationController
def index; end
def show
render locals: { name: params[:id] }
end
end
11 changes: 11 additions & 0 deletions test/dummy/app/views/tabs/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h1>Tabs</h1>

<nav>
<ul>
<% %w[one two three].each do |name| %>
<li><%= link_to "Tab #{name}", tab_path(name), data: { turbo_frame: "tabs" } %>
<% end %>
</ul>
</nav>

<%= turbo_frame_tag "tabs", src: tab_path("one"), data: {turbo_action: "advance"} %>
3 changes: 3 additions & 0 deletions test/dummy/app/views/tabs/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= turbo_frame_tag "tabs" do %>
Tab <%= name %> content
<% end %>
1 change: 1 addition & 0 deletions test/dummy/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
get :section
end
end
resources :tabs
resources :trays
resources :posts
resources :notifications
Expand Down
32 changes: 32 additions & 0 deletions test/system/frames_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true
#
require "application_system_test_case"

class FramesTest < ApplicationSystemTestCase
test "browser history navigation with turbo frames" do
visit tabs_url

assert_selector "h1", text: "Tabs"

assert_selector "turbo-frame", text: "Tab one content"
assert_current_path tabs_path

click_on "Tab two"

assert_selector "turbo-frame", text: "Tab two content"
assert_current_path tab_path("two")

page.go_back

assert_selector "turbo-frame", text: "Tab one content" # fails as of Turbo 8
assert_current_path root_path

page.go_forward

assert_selector "turbo-frame", text: "Tab two content"
assert_current_path tab_path("two")

# we haven't modified the rest of the page (restoration visit)
assert_selector "h1", text: "Tabs" # fails as of Turbo 8
end
end
Loading