diff options
author | Phil Hughes <me@iamphill.com> | 2018-12-04 20:51:57 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-12-04 20:51:57 +0300 |
commit | 9afc3069b00d0f9beee3e838e134d7939823aa1f (patch) | |
tree | 9b424ebf38e1f911f80440c42712878319ff7552 | |
parent | 403430968cf2a98a88d0c454501d883d6508e7e0 (diff) |
Fixed diff files not expanding
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54868
-rw-r--r-- | app/assets/javascripts/diffs/store/actions.js | 2 | ||||
-rw-r--r-- | spec/features/merge_request/user_expands_diff_spec.rb | 23 | ||||
-rw-r--r-- | spec/javascripts/diffs/store/actions_spec.js | 2 |
3 files changed, 25 insertions, 2 deletions
diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index 8b477c678fd..c87e178c8cf 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -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, diff --git a/spec/features/merge_request/user_expands_diff_spec.rb b/spec/features/merge_request/user_expands_diff_spec.rb new file mode 100644 index 00000000000..02fe6352a0f --- /dev/null +++ b/spec/features/merge_request/user_expands_diff_spec.rb @@ -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 diff --git a/spec/javascripts/diffs/store/actions_spec.js b/spec/javascripts/diffs/store/actions_spec.js index 205138bd845..5656ce16db0 100644 --- a/spec/javascripts/diffs/store/actions_spec.js +++ b/spec/javascripts/diffs/store/actions_spec.js @@ -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); |