Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 12:16:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 12:16:11 +0300
commitedaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch)
tree11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb
parentd8a5691316400a0f7ec4f83832698f1988eb27c1 (diff)
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb')
-rw-r--r--spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb b/spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb
new file mode 100644
index 00000000000..1fa8f533869
--- /dev/null
+++ b/spec/features/issues/user_scrolls_to_deeplinked_note_spec.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'User scrolls to deep-linked note' do
+ let_it_be(:project) { create(:project, :public, :repository) }
+ let_it_be(:issue) { create(:issue, project: project) }
+ let_it_be(:comment_1) { create(:note_on_issue, noteable: issue, project: project, note: 'written first') }
+ let_it_be(:comments) { create_list(:note_on_issue, 20, noteable: issue, project: project, note: 'spacer note') }
+
+ context 'on issue page', :js do
+ it 'on comment' do
+ visit project_issue_path(project, issue, anchor: "note_#{comment_1.id}")
+
+ wait_for_requests
+
+ expect(first_comment).to have_content(comment_1.note)
+
+ bottom_of_title = find('.issue-sticky-header.gl-fixed').evaluate_script("this.getBoundingClientRect().bottom;")
+ top = first_comment.evaluate_script("this.getBoundingClientRect().top;")
+
+ expect(top).to be_within(1).of(bottom_of_title)
+ end
+ end
+
+ def all_comments
+ all('.timeline > .note.timeline-entry')
+ end
+
+ def first_comment
+ all_comments.first
+ end
+end