1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Use turbo streams for the bout board instead of auto refreshing every 30 seconds.

This commit is contained in:
2026-02-20 19:20:33 -05:00
parent dc50efe8fc
commit 654cb84827
14 changed files with 324 additions and 87 deletions

View File

@@ -559,6 +559,36 @@ class TournamentsControllerTest < ActionController::TestCase
get_up_matches
success
end
test "up matches uses turbo stream updates instead of timer refresh script" do
@tournament.is_public = true
@tournament.save
get_up_matches
success
assert_includes response.body, "turbo-cable-stream-source"
assert_includes response.body, "data-controller=\"up-matches-connection\""
assert_includes response.body, "up-matches-cable-status-indicator"
assert_not_includes response.body, "This page reloads every 30s"
end
test "up matches shows full screen button when print param is not true" do
@tournament.is_public = true
@tournament.save
get :up_matches, params: { id: @tournament.id }
assert_response :success
assert_includes response.body, "Show Bout Board in Full Screen"
assert_includes response.body, "print=true"
end
test "up matches hides full screen button when print param is true" do
@tournament.is_public = true
@tournament.save
get :up_matches, params: { id: @tournament.id, print: "true" }
assert_response :success
assert_not_includes response.body, "Show Bout Board in Full Screen"
end
# END UP MATCHES PAGE PERMISSIONS
# ALL_RESULTS PAGE PERMISSIONS WHEN TOURNAMENT IS NOT PUBLIC
@@ -643,11 +673,11 @@ class TournamentsControllerTest < ActionController::TestCase
# END ALL_RESULTS PAGE PERMISSIONS
#TESTS THAT NEED MATCHES PUT ABOVE THIS
test "redirect up_matches if no matches" do
test "up_matches renders when no matches exist" do
sign_in_owner
wipe
get :up_matches, params: { id: 1 }
no_matches
success
end
test "redirect bracket if no matches" do

View File

@@ -40,9 +40,9 @@ class UpMatchesCacheTest < ActionController::TestCase
mat.reload
movable_match = mat.queue2_match || mat.queue1_match
assert movable_match, "Expected at least one queued match to move"
mat.assign_match_to_queue!(movable_match, 4)
third_events = cache_events_for_up_matches do
mat.assign_match_to_queue!(movable_match, 4)
get :up_matches, params: { id: @tournament.id }
assert_response :success
end