From 93230c73b711ed52f797cb43cff007f210e889d1 Mon Sep 17 00:00:00 2001 From: ishikawa999 Date: Mon, 18 Aug 2025 00:40:33 +0000 Subject: [PATCH 2/2] Add system test for Edit heading visibility --- test/system/sticky_issue_header_test.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/system/sticky_issue_header_test.rb b/test/system/sticky_issue_header_test.rb index 5c67b36f3..c4fcf449b 100644 --- a/test/system/sticky_issue_header_test.rb +++ b/test/system/sticky_issue_header_test.rb @@ -35,4 +35,26 @@ class StickyIssueHeaderSystemTest < ApplicationSystemTestCase page.execute_script("window.scrollTo(0, 0)") assert_no_selector "#sticky-issue-header", text: issue.subject end + + test "edit heading is not hidden behind sticky header when edit link is clicked" do + log_user('jsmith', 'jsmith') + issue = Issue.find(1) + visit issue_path(issue) + + click_link 'Edit', match: :first + + sleep 0.5 # Wait for scrolling to complete + assert_selector "#sticky-issue-header.is-visible", visible: true + assert_selector 'h3', text: 'Edit', visible: true + + # More strictly check whether the Edit heading is visually accessible using JavaScript + is_edit_heading_visible_to_user = page.evaluate_script(<<~JS) + (function() { + const stickyIssueHeader = document.querySelector('#sticky-issue-header'); + const editHeading = document.querySelector("#update > h3"); + return stickyIssueHeader.getBoundingClientRect().bottom < editHeading.getBoundingClientRect().top; + })(); + JS + assert is_edit_heading_visible_to_user, "Edit heading is visually covered by the sticky header" + end end -- 2.50.1