Commit a1179e5e authored by Fatih Acet's avatar Fatih Acet

Fix showing HTML content in view file tooltip

parent 8c10e99d
...@@ -112,9 +112,7 @@ export default { ...@@ -112,9 +112,7 @@ export default {
const truncatedContentSha = _.escape(truncateSha(this.diffFile.content_sha)); const truncatedContentSha = _.escape(truncateSha(this.diffFile.content_sha));
return sprintf( return sprintf(
s__('MergeRequests|View file @ %{commitId}'), s__('MergeRequests|View file @ %{commitId}'),
{ { commitId: truncatedContentSha },
commitId: `<span class="commit-sha">${truncatedContentSha}</span>`,
},
false, false,
); );
}, },
......
...@@ -611,6 +611,9 @@ describe('diff_file_header', () => { ...@@ -611,6 +611,9 @@ describe('diff_file_header', () => {
vm = mountComponentWithStore(Component, { props, store }); vm = mountComponentWithStore(Component, { props, store });
expect(viewFileButton().getAttribute('href')).toBe('view-path'); expect(viewFileButton().getAttribute('href')).toBe('view-path');
expect(viewFileButton().getAttribute('data-original-title')).toEqual(
`View file @ ${props.diffFile.content_sha.substr(0, 8)}`,
);
}); });
it('should not render external url view link if diff file has no external url', () => { it('should not render external url view link if diff file has no external url', () => {
......
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