diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/frontend/diffs/components/diff_file_spec.js | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/frontend/diffs/components/diff_file_spec.js')
-rw-r--r-- | spec/frontend/diffs/components/diff_file_spec.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/frontend/diffs/components/diff_file_spec.js b/spec/frontend/diffs/components/diff_file_spec.js index 99dda8d5deb..3dec56f2fe3 100644 --- a/spec/frontend/diffs/components/diff_file_spec.js +++ b/spec/frontend/diffs/components/diff_file_spec.js @@ -521,4 +521,54 @@ describe('DiffFile', () => { expect(button.attributes('href')).toBe('/file/view/path'); }); }); + + it('loads collapsed file on mounted when single file mode is enabled', async () => { + wrapper.destroy(); + + const file = { + ...getReadableFile(), + load_collapsed_diff_url: '/diff_for_path', + highlighted_diff_lines: [], + parallel_diff_lines: [], + viewer: { name: 'collapsed', automaticallyCollapsed: true }, + }; + + axiosMock.onGet(file.load_collapsed_diff_url).reply(httpStatus.OK, getReadableFile()); + + ({ wrapper, store } = createComponent({ file, props: { viewDiffsFileByFile: true } })); + + await wrapper.vm.$nextTick(); + + expect(findLoader(wrapper).exists()).toBe(true); + }); + + describe('merge conflicts', () => { + beforeEach(() => { + wrapper.destroy(); + }); + + it('does not render conflict alert', () => { + const file = { + ...getReadableFile(), + conflict_type: null, + renderIt: true, + }; + + ({ wrapper, store } = createComponent({ file })); + + expect(wrapper.find('[data-testid="conflictsAlert"]').exists()).toBe(false); + }); + + it('renders conflict alert when conflict_type is present', () => { + const file = { + ...getReadableFile(), + conflict_type: 'both_modified', + renderIt: true, + }; + + ({ wrapper, store } = createComponent({ file })); + + expect(wrapper.find('[data-testid="conflictsAlert"]').exists()).toBe(true); + }); + }); }); |