Commit e2a33054 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'nfriend-31374-fix-permalink-button' into 'master'

Fix Permalink and Blame button hash parameter

Closes #31374

See merge request gitlab-org/gitlab!23713
parents 4d52ab97 c6ee2a3e
......@@ -11,7 +11,7 @@ export default () => {
// eslint-disable-next-line no-new
new BlobLinePermalinkUpdater(
document.querySelector('#blob-content-holder'),
'.diff-line-num[data-line-number]',
'.diff-line-num[data-line-number], .diff-line-num[data-line-number] *',
document.querySelectorAll('.js-data-file-blob-permalink-url, .js-blob-blame-link'),
);
......
---
title: Fix hash parameter of Permalink and Blame button
merge_request: 23713
author:
type: fixed
......@@ -44,6 +44,17 @@ describe 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js do
expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(project_blob_path(project, tree_join(sha, path), anchor: ending_fragment)))
end
it 'changes fragment hash if icon inside line number link is clicked' do
ending_fragment = "L7"
visit_blob
find("##{ending_fragment}").hover
find("##{ending_fragment} i").click
expect(find('.js-data-file-blob-permalink-url')['href']).to eq(get_absolute_url(project_blob_path(project, tree_join(sha, path), anchor: ending_fragment)))
end
it 'with initial fragment hash, changes fragment hash if line number clicked' do
fragment = "L1"
ending_fragment = "L5"
......@@ -83,6 +94,17 @@ describe 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js do
expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: ending_fragment)))
end
it 'changes fragment hash if icon inside line number link is clicked' do
ending_fragment = "L7"
visit_blob
find("##{ending_fragment}").hover
find("##{ending_fragment} i").click
expect(find('.js-blob-blame-link')['href']).to eq(get_absolute_url(project_blame_path(project, tree_join('master', path), anchor: ending_fragment)))
end
it 'with initial fragment hash, changes fragment hash if line number clicked' do
fragment = "L1"
ending_fragment = "L5"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment