gitlab-org--gitlab-foss/spec/features/merge_request/user_views_diffs_spec.rb
Phil Hughes 33c4c5b8f3
Added file tree to merge request diffs
This file tree displays all the diff files in a tree like format
Each file is taken and converted into a tree with folders
Each folder can be toggled open & closed
Clicking a file will scroll to the diff file & highlight with a glow affect

Searching the tree list will search only files & return a list of the
files without any folders

Each file row contains an icon to show changed, new file or deleted
Each row will also contain the added & removed lines count

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/14249
2018-10-03 10:05:43 +01:00

60 lines
1.5 KiB
Ruby

require 'spec_helper'
describe 'User views diffs', :js do
let(:merge_request) do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end
let(:project) { create(:project, :public, :repository) }
before do
visit(diffs_project_merge_request_path(project, merge_request))
wait_for_requests
find('.js-toggle-tree-list').click
end
shared_examples 'unfold diffs' do
it 'unfolds diffs' do
first('.js-unfold').click
expect(find('.file-holder[id="a5cc2925ca8258af241be7e5b0381edf30266302"] .text-file')).to have_content('.bundle')
end
end
it 'shows diffs' do
expect(page).to have_css('.tab-content #diffs.active')
expect(page).to have_css('#parallel-diff-btn', count: 1)
expect(page).to have_css('#inline-diff-btn', count: 1)
end
it 'hides loading spinner after load' do
expect(page).not_to have_selector('.mr-loading-status .loading', visible: true)
end
context 'when in the inline view' do
include_examples 'unfold diffs'
end
context 'when in the side-by-side view' do
before do
click_button 'Side-by-side'
wait_for_requests
end
it 'shows diffs in parallel' do
expect(page).to have_css('.parallel')
end
it 'toggles container class' do
expect(page).not_to have_css('.content-wrapper > .container-fluid.container-limited')
click_link 'Commits'
expect(page).to have_css('.content-wrapper > .container-fluid.container-limited')
end
include_examples 'unfold diffs'
end
end