From b76ae638462ab0f673e5915986070518dd3f9ad3 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Aug 2021 09:08:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-2-stable-ee --- spec/frontend/diffs/components/app_spec.js | 52 +++--------------------------- 1 file changed, 5 insertions(+), 47 deletions(-) (limited to 'spec/frontend/diffs/components/app_spec.js') diff --git a/spec/frontend/diffs/components/app_spec.js b/spec/frontend/diffs/components/app_spec.js index b5eb3e1713c..1464dd84666 100644 --- a/spec/frontend/diffs/components/app_spec.js +++ b/spec/frontend/diffs/components/app_spec.js @@ -4,6 +4,7 @@ import MockAdapter from 'axios-mock-adapter'; import Mousetrap from 'mousetrap'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; +import setWindowLocation from 'helpers/set_window_location_helper'; import { TEST_HOST } from 'spec/test_constants'; import App from '~/diffs/components/app.vue'; import CommitWidget from '~/diffs/components/commit_widget.vue'; @@ -16,7 +17,6 @@ import TreeList from '~/diffs/components/tree_list.vue'; /* You know what: sometimes alphabetical isn't the best order */ import CollapsedFilesWarning from '~/diffs/components/collapsed_files_warning.vue'; import HiddenFilesWarning from '~/diffs/components/hidden_files_warning.vue'; -import MergeConflictWarning from '~/diffs/components/merge_conflict_warning.vue'; /* eslint-enable import/order */ import axios from '~/lib/utils/axios_utils'; @@ -258,6 +258,8 @@ describe('diffs/components/app', () => { }); it('marks current diff file based on currently highlighted row', async () => { + window.location.hash = 'ABC_123'; + createComponent({ shouldShow: true, }); @@ -428,12 +430,9 @@ describe('diffs/components/app', () => { jest.spyOn(wrapper.vm, 'refetchDiffData').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'adjustView').mockImplementation(() => {}); }; - let location; - beforeAll(() => { - location = window.location; - delete window.location; - window.location = COMMIT_URL; + beforeEach(() => { + setWindowLocation(COMMIT_URL); document.title = 'My Title'; }); @@ -441,10 +440,6 @@ describe('diffs/components/app', () => { jest.spyOn(urlUtils, 'updateHistory'); }); - afterAll(() => { - window.location = location; - }); - it('when the commit changes and the app is not loading it should update the history, refetch the diff data, and update the view', async () => { createComponent({}, ({ state }) => { state.diffs.commit = { ...state.diffs.commit, id: 'OLD' }; @@ -546,43 +541,6 @@ describe('diffs/components/app', () => { expect(getCollapsedFilesWarning(wrapper).exists()).toBe(false); }); }); - - describe('merge conflicts', () => { - it('should render the merge conflicts banner if viewing the whole changeset and there are conflicts', () => { - createComponent({}, ({ state }) => { - Object.assign(state.diffs, { - latestDiff: true, - startVersion: null, - hasConflicts: true, - canMerge: false, - conflictResolutionPath: 'path', - }); - }); - - expect(wrapper.find(MergeConflictWarning).exists()).toBe(true); - }); - - it.each` - prop | value - ${'latestDiff'} | ${false} - ${'startVersion'} | ${'notnull'} - ${'hasConflicts'} | ${false} - `( - "should not render if any of the MR properties aren't correct - like $prop: $value", - ({ prop, value }) => { - createComponent({}, ({ state }) => { - Object.assign(state.diffs, { - latestDiff: true, - startVersion: null, - hasConflicts: true, - [prop]: value, - }); - }); - - expect(wrapper.find(MergeConflictWarning).exists()).toBe(false); - }, - ); - }); }); it('should display commit widget if store has a commit', () => { -- cgit v1.2.1