rework the html_safe not to use haml's auto escaping

add feature test for inline diff in file header
This commit is contained in:
micael.bergeron 2017-09-11 11:17:59 -04:00 committed by GitLab Development
parent d70c3bbc14
commit a91101d0ac
3 changed files with 21 additions and 3 deletions

View File

@ -17,12 +17,12 @@
= blob_icon diff_file.b_mode, diff_file.file_path
- if diff_file.renamed_file?
- old_path, new_path = mark_inline_diffs(diff_file.old_path, diff_file.new_path)
- old_path, new_path = mark_inline_diffs(diff_file.old_path, diff_file.new_path).map(&:html_safe)
%strong.file-title-name.has-tooltip{ data: { title: diff_file.old_path, container: 'body' } }
!= old_path
= old_path
→
%strong.file-title-name.has-tooltip{ data: { title: diff_file.new_path, container: 'body' } }
!= new_path
= new_path
- else
%strong.file-title-name.has-tooltip{ data: { title: diff_file.file_path, container: 'body' } }
= diff_file.file_path

View File

@ -0,0 +1,5 @@
---
title: Fix the diff file header from being html escaped for renamed files.
merge_request: 14121
author:
type: fixed

View File

@ -108,6 +108,19 @@ feature 'Diff file viewer', :js do
end
end
context 'renamed file' do
before do
visit_commit('6907208d755b60ebeacb2e9dfea74c92c3449a1f')
end
it 'shows the filename with diff highlight' do
within('.file-header-content') do
expect(page).to have_css('.idiff.left.right.deletion')
expect(page).to have_content('files/js/commit.coffee')
end
end
end
context 'binary file that appears to be text in the first 1024 bytes' do
before do
# The file we're visiting is smaller than 10 KB and we want it collapsed