diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-23 21:10:24 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-23 21:10:24 +0000 |
commit | 5838993b5f3e2d861d9dd7c82dfeea71506b9fc2 (patch) | |
tree | caab6621fb79f06a355f802dc885982f746b544d /spec/frontend/diffs/components | |
parent | b8d021cb606ac86f41a0ef9dacd133a9677f8414 (diff) | |
download | gitlab-ce-5838993b5f3e2d861d9dd7c82dfeea71506b9fc2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/diffs/components')
14 files changed, 47 insertions, 47 deletions
diff --git a/spec/frontend/diffs/components/app_spec.js b/spec/frontend/diffs/components/app_spec.js index 416564b72c3..34eca7eee35 100644 --- a/spec/frontend/diffs/components/app_spec.js +++ b/spec/frontend/diffs/components/app_spec.js @@ -102,13 +102,13 @@ describe('diffs/components/app', () => { }); describe('fetch diff methods', () => { - beforeEach(done => { + beforeEach((done) => { const fetchResolver = () => { store.state.diffs.retrievingBatches = false; store.state.notes.discussions = 'test'; return Promise.resolve({ real_size: 100 }); }; - jest.spyOn(window, 'requestIdleCallback').mockImplementation(fn => fn()); + jest.spyOn(window, 'requestIdleCallback').mockImplementation((fn) => fn()); createComponent(); jest.spyOn(wrapper.vm, 'fetchDiffFilesMeta').mockImplementation(fetchResolver); jest.spyOn(wrapper.vm, 'fetchDiffFilesBatch').mockImplementation(fetchResolver); @@ -122,7 +122,7 @@ describe('diffs/components/app', () => { wrapper.vm.$nextTick(done); }); - it('calls batch methods if diffsBatchLoad is enabled, and not latest version', done => { + it('calls batch methods if diffsBatchLoad is enabled, and not latest version', (done) => { expect(wrapper.vm.diffFilesLength).toEqual(0); wrapper.vm.isLatestVersion = () => false; wrapper.vm.fetchData(false); @@ -139,7 +139,7 @@ describe('diffs/components/app', () => { }); }); - it('calls batch methods if diffsBatchLoad is enabled, and latest version', done => { + it('calls batch methods if diffsBatchLoad is enabled, and latest version', (done) => { expect(wrapper.vm.diffFilesLength).toEqual(0); wrapper.vm.fetchData(false); @@ -216,7 +216,7 @@ describe('diffs/components/app', () => { window.location.hash = 'ABC_123'; }); - it('sets highlighted row if hash exists in location object', done => { + it('sets highlighted row if hash exists in location object', (done) => { createComponent({ shouldShow: true, }); @@ -267,7 +267,7 @@ describe('diffs/components/app', () => { }); }); - it('marks current diff file based on currently highlighted row', done => { + it('marks current diff file based on currently highlighted row', (done) => { createComponent({ shouldShow: true, }); @@ -439,7 +439,7 @@ describe('diffs/components/app', () => { wrapper.destroy(); }); - it('jumps to next and previous files in the list', done => { + it('jumps to next and previous files in the list', (done) => { wrapper.vm .$nextTick() .then(() => { @@ -459,7 +459,7 @@ describe('diffs/components/app', () => { .catch(done.fail); }); - it('does not jump to previous file from the first one', done => { + it('does not jump to previous file from the first one', (done) => { wrapper.vm .$nextTick() .then(() => { @@ -476,7 +476,7 @@ describe('diffs/components/app', () => { .catch(done.fail); }); - it('does not jump to next file from the last one', done => { + it('does not jump to next file from the last one', (done) => { wrapper.vm .$nextTick() .then(() => { diff --git a/spec/frontend/diffs/components/compare_dropdown_layout_spec.js b/spec/frontend/diffs/components/compare_dropdown_layout_spec.js index 92e4a2d9c62..d99933a1ee9 100644 --- a/spec/frontend/diffs/components/compare_dropdown_layout_spec.js +++ b/spec/frontend/diffs/components/compare_dropdown_layout_spec.js @@ -31,7 +31,7 @@ describe('CompareDropdownLayout', () => { const findListItems = () => wrapper.findAll('li'); const findListItemsData = () => - findListItems().wrappers.map(listItem => ({ + findListItems().wrappers.map((listItem) => ({ href: listItem.find('a').attributes('href'), text: trimText(listItem.text()), createdAt: listItem.findAll(TimeAgo).wrappers[0]?.props('time'), diff --git a/spec/frontend/diffs/components/compare_versions_spec.js b/spec/frontend/diffs/components/compare_versions_spec.js index 09e9669c474..cd7697676c4 100644 --- a/spec/frontend/diffs/components/compare_versions_spec.js +++ b/spec/frontend/diffs/components/compare_versions_spec.js @@ -13,7 +13,7 @@ describe('CompareVersions', () => { let wrapper; const targetBranchName = 'tmp-wine-dev'; - const createWrapper = props => { + const createWrapper = (props) => { const store = createStore(); const mergeRequestDiff = diffsMockData[0]; @@ -121,7 +121,7 @@ describe('CompareVersions', () => { }); describe('commit', () => { - beforeEach(done => { + beforeEach((done) => { wrapper.vm.$store.state.diffs.commit = getDiffWithCommit().commit; wrapper.mergeRequestDiffs = []; diff --git a/spec/frontend/diffs/components/diff_content_spec.js b/spec/frontend/diffs/components/diff_content_spec.js index 43d295ff1b3..c1cf4793c88 100644 --- a/spec/frontend/diffs/components/diff_content_spec.js +++ b/spec/frontend/diffs/components/diff_content_spec.js @@ -102,7 +102,7 @@ describe('DiffContent', () => { describe('with text based files', () => { afterEach(() => { - [isParallelViewGetterMock, isInlineViewGetterMock].forEach(m => m.mockRestore()); + [isParallelViewGetterMock, isInlineViewGetterMock].forEach((m) => m.mockRestore()); }); const textDiffFile = { ...defaultProps.diffFile, viewer: { name: diffViewerModes.text } }; diff --git a/spec/frontend/diffs/components/diff_discussions_spec.js b/spec/frontend/diffs/components/diff_discussions_spec.js index 4f2fa4b84e3..5c390054247 100644 --- a/spec/frontend/diffs/components/diff_discussions_spec.js +++ b/spec/frontend/diffs/components/diff_discussions_spec.js @@ -15,7 +15,7 @@ describe('DiffDiscussions', () => { let wrapper; const getDiscussionsMockData = () => [{ ...discussionsMockData }]; - const createComponent = props => { + const createComponent = (props) => { store = createStore(); wrapper = mount(localVue.extend(DiffDiscussions), { store, diff --git a/spec/frontend/diffs/components/diff_expansion_cell_spec.js b/spec/frontend/diffs/components/diff_expansion_cell_spec.js index a3b4b5c3abb..1e28d48fe1b 100644 --- a/spec/frontend/diffs/components/diff_expansion_cell_spec.js +++ b/spec/frontend/diffs/components/diff_expansion_cell_spec.js @@ -14,7 +14,7 @@ const lineSources = { [INLINE_DIFF_VIEW_TYPE]: 'highlighted_diff_lines', }; const lineHandlers = { - [INLINE_DIFF_VIEW_TYPE]: line => line, + [INLINE_DIFF_VIEW_TYPE]: (line) => line, }; function makeLoadMoreLinesPayload({ diff --git a/spec/frontend/diffs/components/diff_file_spec.js b/spec/frontend/diffs/components/diff_file_spec.js index 71e0ffd176f..77d83b102aa 100644 --- a/spec/frontend/diffs/components/diff_file_spec.js +++ b/spec/frontend/diffs/components/diff_file_spec.js @@ -96,13 +96,13 @@ function createComponent({ file, first = false, last = false }) { }; } -const findDiffHeader = wrapper => wrapper.find(DiffFileHeaderComponent); -const findDiffContentArea = wrapper => wrapper.find('[data-testid="content-area"]'); -const findLoader = wrapper => wrapper.find('[data-testid="loader-icon"]'); -const findToggleButton = wrapper => wrapper.find('[data-testid="expand-button"]'); +const findDiffHeader = (wrapper) => wrapper.find(DiffFileHeaderComponent); +const findDiffContentArea = (wrapper) => wrapper.find('[data-testid="content-area"]'); +const findLoader = (wrapper) => wrapper.find('[data-testid="loader-icon"]'); +const findToggleButton = (wrapper) => wrapper.find('[data-testid="expand-button"]'); -const toggleFile = wrapper => findDiffHeader(wrapper).vm.$emit('toggleFile'); -const isDisplayNone = element => element.style.display === 'none'; +const toggleFile = (wrapper) => findDiffHeader(wrapper).vm.$emit('toggleFile'); +const isDisplayNone = (element) => element.style.display === 'none'; const getReadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataReadable)); const getUnreadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataUnreadable)); @@ -157,7 +157,7 @@ describe('DiffFile', () => { await wrapper.vm.$nextTick(); expect(eventHub.$emit).toHaveBeenCalledTimes(events.length); - events.forEach(event => { + events.forEach((event) => { expect(eventHub.$emit).toHaveBeenCalledWith(event); }); }, @@ -174,7 +174,7 @@ describe('DiffFile', () => { })); jest.spyOn(wrapper.vm, 'loadCollapsedDiff').mockResolvedValue(getReadableFile()); - jest.spyOn(window, 'requestIdleCallback').mockImplementation(fn => fn()); + jest.spyOn(window, 'requestIdleCallback').mockImplementation((fn) => fn()); makeFileAutomaticallyCollapsed(store); @@ -247,7 +247,7 @@ describe('DiffFile', () => { it('should not have any content at all', async () => { await wrapper.vm.$nextTick(); - Array.from(findDiffContentArea(wrapper).element.children).forEach(child => { + Array.from(findDiffContentArea(wrapper).element.children).forEach((child) => { expect(isDisplayNone(child)).toBe(true); }); }); diff --git a/spec/frontend/diffs/components/diff_line_note_form_spec.js b/spec/frontend/diffs/components/diff_line_note_form_spec.js index 75ec5c202af..42815e63ef7 100644 --- a/spec/frontend/diffs/components/diff_line_note_form_spec.js +++ b/spec/frontend/diffs/components/diff_line_note_form_spec.js @@ -51,7 +51,7 @@ describe('DiffLineNoteForm', () => { expect(window.confirm).not.toHaveBeenCalled(); }); - it('should call cancelCommentForm with lineCode', done => { + it('should call cancelCommentForm with lineCode', (done) => { jest.spyOn(window, 'confirm').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'cancelCommentForm').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'resetAutoSave').mockImplementation(() => {}); @@ -72,7 +72,7 @@ describe('DiffLineNoteForm', () => { }); describe('saveNoteForm', () => { - it('should call saveNote action with proper params', done => { + it('should call saveNote action with proper params', (done) => { const saveDiffDiscussionSpy = jest .spyOn(wrapper.vm, 'saveDiffDiscussion') .mockReturnValue(Promise.resolve()); diff --git a/spec/frontend/diffs/components/diff_stats_spec.js b/spec/frontend/diffs/components/diff_stats_spec.js index 4dcbb3ec332..0aaec027c0a 100644 --- a/spec/frontend/diffs/components/diff_stats_spec.js +++ b/spec/frontend/diffs/components/diff_stats_spec.js @@ -39,7 +39,7 @@ describe('diff_stats', () => { }); describe('line changes', () => { - const findFileLine = name => wrapper.find(name); + const findFileLine = (name) => wrapper.find(name); it('shows the amount of lines added', () => { expect(findFileLine('.js-file-addition-line').text()).toBe(TEST_ADDED_LINES.toString()); @@ -51,10 +51,10 @@ describe('diff_stats', () => { }); describe('files changes', () => { - const findIcon = name => + const findIcon = (name) => wrapper .findAll(GlIcon) - .filter(c => c.attributes('name') === name) + .filter((c) => c.attributes('name') === name) .at(0).element.parentNode; it('shows amount of file changed with plural "files" when 0 files has changed', () => { diff --git a/spec/frontend/diffs/components/diff_view_spec.js b/spec/frontend/diffs/components/diff_view_spec.js index 2190aa1794f..9d1242e4b77 100644 --- a/spec/frontend/diffs/components/diff_view_spec.js +++ b/spec/frontend/diffs/components/diff_view_spec.js @@ -11,7 +11,7 @@ describe('DiffView', () => { const DiffRow = { template: `<div/>` }; const DiffCommentCell = { template: `<div/>` }; const DraftNote = { template: `<div/>` }; - const createWrapper = props => { + const createWrapper = (props) => { const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/diffs/components/image_diff_overlay_spec.js b/spec/frontend/diffs/components/image_diff_overlay_spec.js index 209c101d09f..21e154578a1 100644 --- a/spec/frontend/diffs/components/image_diff_overlay_spec.js +++ b/spec/frontend/diffs/components/image_diff_overlay_spec.js @@ -114,7 +114,7 @@ describe('Diffs image diff overlay component', () => { describe('comment form', () => { const getCommentIndicator = () => wrapper.find('.comment-indicator'); beforeEach(() => { - createComponent({ canComment: true }, store => { + createComponent({ canComment: true }, (store) => { store.state.diffs.commentForms.push({ fileHash: 'ABC', x: 20, diff --git a/spec/frontend/diffs/components/no_changes_spec.js b/spec/frontend/diffs/components/no_changes_spec.js index 78805a1cddc..5d00a04d415 100644 --- a/spec/frontend/diffs/components/no_changes_spec.js +++ b/spec/frontend/diffs/components/no_changes_spec.js @@ -28,7 +28,7 @@ describe('Diff no changes empty state', () => { }); it('prevents XSS', () => { - createComponent(store => { + createComponent((store) => { // eslint-disable-next-line no-param-reassign store.state.notes.noteableData = { source_branch: '<script>alert("test");</script>', diff --git a/spec/frontend/diffs/components/parallel_diff_table_row_spec.js b/spec/frontend/diffs/components/parallel_diff_table_row_spec.js index 57eff177261..445553706b7 100644 --- a/spec/frontend/diffs/components/parallel_diff_table_row_spec.js +++ b/spec/frontend/diffs/components/parallel_diff_table_row_spec.js @@ -40,7 +40,7 @@ describe('ParallelDiffTableRow', () => { vm = wrapper.vm; }); - it('does not highlight non empty line content when line does not match highlighted row', done => { + it('does not highlight non empty line content when line does not match highlighted row', (done) => { vm.$nextTick() .then(() => { expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll'); @@ -49,7 +49,7 @@ describe('ParallelDiffTableRow', () => { .catch(done.fail); }); - it('highlights nonempty line content when line is the highlighted row', done => { + it('highlights nonempty line content when line is the highlighted row', (done) => { vm.$nextTick() .then(() => { vm.$store.state.diffs.highlightedRow = rightLine.line_code; @@ -86,7 +86,7 @@ describe('ParallelDiffTableRow', () => { }).$mount(); }); - it('does not highlight either line when line does not match highlighted row', done => { + it('does not highlight either line when line does not match highlighted row', (done) => { vm.$nextTick() .then(() => { expect(vm.$el.querySelector('.line_content.right-side').classList).not.toContain('hll'); @@ -96,7 +96,7 @@ describe('ParallelDiffTableRow', () => { .catch(done.fail); }); - it('adds hll class to lineContent when line is the highlighted row', done => { + it('adds hll class to lineContent when line is the highlighted row', (done) => { vm.$nextTick() .then(() => { vm.$store.state.diffs.highlightedRow = rightLine.line_code; @@ -112,7 +112,7 @@ describe('ParallelDiffTableRow', () => { }); describe('sets coverage title and class', () => { - it('for lines with coverage', done => { + it('for lines with coverage', (done) => { vm.$nextTick() .then(() => { const name = diffFileMockData.file_path; @@ -132,7 +132,7 @@ describe('ParallelDiffTableRow', () => { .catch(done.fail); }); - it('for lines without coverage', done => { + it('for lines without coverage', (done) => { vm.$nextTick() .then(() => { const name = diffFileMockData.file_path; @@ -152,7 +152,7 @@ describe('ParallelDiffTableRow', () => { .catch(done.fail); }); - it('for unknown lines', done => { + it('for unknown lines', (done) => { vm.$nextTick() .then(() => { vm.$store.state.diffs.coverageFiles = {}; diff --git a/spec/frontend/diffs/components/settings_dropdown_spec.js b/spec/frontend/diffs/components/settings_dropdown_spec.js index eb9f9b4db73..fcb627c570a 100644 --- a/spec/frontend/diffs/components/settings_dropdown_spec.js +++ b/spec/frontend/diffs/components/settings_dropdown_spec.js @@ -73,7 +73,7 @@ describe('Diff settings dropdown component', () => { }); it('sets list button as selected when renderTreeList is false', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { renderTreeList: false, }); @@ -84,7 +84,7 @@ describe('Diff settings dropdown component', () => { }); it('sets tree button as selected when renderTreeList is true', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { renderTreeList: true, }); @@ -97,7 +97,7 @@ describe('Diff settings dropdown component', () => { describe('compare changes', () => { it('sets inline button as selected', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { diffViewType: INLINE_DIFF_VIEW_TYPE, }); @@ -108,7 +108,7 @@ describe('Diff settings dropdown component', () => { }); it('sets parallel button as selected', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { diffViewType: PARALLEL_DIFF_VIEW_TYPE, }); @@ -137,7 +137,7 @@ describe('Diff settings dropdown component', () => { describe('whitespace toggle', () => { it('does not set as checked when showWhitespace is false', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { showWhitespace: false, }); @@ -147,7 +147,7 @@ describe('Diff settings dropdown component', () => { }); it('sets as checked when showWhitespace is true', () => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { showWhitespace: true, }); @@ -183,7 +183,7 @@ describe('Diff settings dropdown component', () => { `( 'sets the checkbox to { checked: $checked } if the fileByFile setting is $fileByFile', async ({ fileByFile, checked }) => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { viewDiffsFileByFile: fileByFile, }); @@ -202,7 +202,7 @@ describe('Diff settings dropdown component', () => { `( 'when the file by file setting starts as $start, toggling the checkbox should emit an event set to $emit', async ({ start, emit }) => { - createComponent(store => { + createComponent((store) => { Object.assign(store.state.diffs, { viewDiffsFileByFile: start, }); |