2017-10-04 18:31:34 -04:00
|
|
|
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
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples 'unfold diffs' do
|
|
|
|
it 'unfolds diffs' do
|
|
|
|
first('.js-unfold').click
|
|
|
|
|
2018-06-21 08:22:40 -04:00
|
|
|
expect(find('.file-holder[id="a5cc2925ca8258af241be7e5b0381edf30266302"] .text-file')).to have_content('.bundle')
|
2017-10-04 18:31:34 -04:00
|
|
|
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
|
|
|
|
|
2018-05-29 10:49:28 -04:00
|
|
|
it 'hides loading spinner after load' do
|
|
|
|
expect(page).not_to have_selector('.mr-loading-status .loading', visible: true)
|
|
|
|
end
|
|
|
|
|
2017-10-04 18:31:34 -04:00
|
|
|
context 'when in the inline view' do
|
|
|
|
include_examples 'unfold diffs'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when in the side-by-side view' do
|
|
|
|
before do
|
2018-06-21 08:22:40 -04:00
|
|
|
click_button 'Side-by-side'
|
2017-10-04 18:31:34 -04:00
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows diffs in parallel' do
|
|
|
|
expect(page).to have_css('.parallel')
|
|
|
|
end
|
|
|
|
|
2018-06-21 08:22:40 -04:00
|
|
|
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
|
|
|
|
|
2017-10-04 18:31:34 -04:00
|
|
|
include_examples 'unfold diffs'
|
|
|
|
end
|
|
|
|
end
|