Fixed diff files not expanding

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54868
This commit is contained in:
Phil Hughes 2018-12-04 17:51:57 +00:00
parent 403430968c
commit 9afc3069b0
No known key found for this signature in database
GPG Key ID: 32245528C52E0F9F
3 changed files with 25 additions and 2 deletions

View File

@ -148,7 +148,7 @@ export const scrollToLineIfNeededParallel = (_, line) => {
};
export const loadCollapsedDiff = ({ commit }, file) =>
axios.get(file.loadCollapsedDiffUrl).then(res => {
axios.get(file.load_collapsed_diff_url).then(res => {
commit(types.ADD_COLLAPSED_DIFFS, {
file,
data: res.data,

View File

@ -0,0 +1,23 @@
require 'spec_helper'
describe 'User expands diff', :js do
let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
before do
visit(diffs_project_merge_request_path(project, merge_request))
wait_for_requests
end
it 'allows user to expand diff' do
page.within find('[id="19763941ab80e8c09871c0a425f0560d9053bcb3"]') do
click_link 'Click to expand it.'
wait_for_requests
expect(page).not_to have_content('Click to expand it.')
expect(page).to have_selector('.code')
end
end
end

View File

@ -379,7 +379,7 @@ describe('DiffsStoreActions', () => {
describe('loadCollapsedDiff', () => {
it('should fetch data and call mutation with response and the give parameter', done => {
const file = { hash: 123, loadCollapsedDiffUrl: '/load/collapsed/diff/url' };
const file = { hash: 123, load_collapsed_diff_url: '/load/collapsed/diff/url' };
const data = { hash: 123, parallelDiffLines: [{ lineCode: 1 }] };
const mock = new MockAdapter(axios);
mock.onGet(file.loadCollapsedDiffUrl).reply(200, data);