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>2023-10-19 15:57:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-19 15:57:54 +0300
commit419c53ec62de6e97a517abd5fdd4cbde3a942a34 (patch)
tree1f43a548b46bca8a5fb8fe0c31cef1883d49c5b6 /spec/features/projects/blobs/blob_line_permalink_updater_spec.rb
parent1da20d9135b3ad9e75e65b028bffc921aaf8deb7 (diff)
Add latest changes from gitlab-org/gitlab@16-5-stable-eev16.5.0-rc42
Diffstat (limited to 'spec/features/projects/blobs/blob_line_permalink_updater_spec.rb')
-rw-r--r--spec/features/projects/blobs/blob_line_permalink_updater_spec.rb48
1 files changed, 44 insertions, 4 deletions
diff --git a/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb b/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb
index f0058e75e52..89f6e41bec0 100644
--- a/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb
+++ b/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb
@@ -55,10 +55,50 @@ RSpec.describe 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js, fe
end
describe 'Click "Blame" button' do
+ context 'when redirect_with_ref_type is disabled' do
+ before do
+ stub_feature_flags(redirect_with_ref_type: false)
+ end
+
+ it 'works with no initial line number fragment hash' do
+ visit_blob
+
+ expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path))))
+ end
+
+ it 'maintains intitial fragment hash' do
+ fragment = "L3"
+
+ visit_blob(fragment)
+
+ expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: fragment)))
+ end
+
+ it 'changes fragment hash if line number clicked' do
+ visit_blob
+
+ find('#L3').click
+ find("#L5").click
+
+ expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: "L5")))
+ end
+
+ it 'with initial fragment hash, changes fragment hash if line number clicked' do
+ fragment = "L1"
+
+ visit_blob(fragment)
+
+ find('#L3').click
+ find("#L5").click
+
+ expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: "L5")))
+ end
+ end
+
it 'works with no initial line number fragment hash' do
visit_blob
- expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path))))
+ expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), ref_type: 'heads')))
end
it 'maintains intitial fragment hash' do
@@ -66,7 +106,7 @@ RSpec.describe 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js, fe
visit_blob(fragment)
- expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: fragment)))
+ expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), ref_type: 'heads', anchor: fragment)))
end
it 'changes fragment hash if line number clicked' do
@@ -75,7 +115,7 @@ RSpec.describe 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js, fe
find('#L3').click
find("#L5").click
- expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: "L5")))
+ expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), ref_type: 'heads', anchor: "L5")))
end
it 'with initial fragment hash, changes fragment hash if line number clicked' do
@@ -86,7 +126,7 @@ RSpec.describe 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js, fe
find('#L3').click
find("#L5").click
- expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: "L5")))
+ expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), ref_type: 'heads', anchor: "L5")))
end
end
end