diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 14:02:45 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-18 14:02:45 +0000 |
commit | 80f61b4035607d7cd87de993b8f5e996bde3481f (patch) | |
tree | 06b12f51e97d87192e3dd0e05edf55143645b894 /spec/javascripts | |
parent | 4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff) | |
download | gitlab-ce-80f61b4035607d7cd87de993b8f5e996bde3481f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts')
34 files changed, 690 insertions, 867 deletions
diff --git a/spec/javascripts/boards/components/board_spec.js b/spec/javascripts/boards/components/board_spec.js index 683783334c6..ccb657e0df1 100644 --- a/spec/javascripts/boards/components/board_spec.js +++ b/spec/javascripts/boards/components/board_spec.js @@ -5,21 +5,16 @@ import { mockBoardService } from '../mock_data'; describe('Board component', () => { let vm; - let el; - beforeEach(done => { - loadFixtures('boards/show.html'); - - el = document.createElement('div'); + const createComponent = ({ gon = {}, collapsed = false, listType = 'backlog' } = {}) => { + if (Object.prototype.hasOwnProperty.call(gon, 'current_user_id')) { + window.gon = gon; + } else { + window.gon = {}; + } + const el = document.createElement('div'); document.body.appendChild(el); - gl.boardService = mockBoardService({ - boardsEndpoint: '/', - listsEndpoint: '/', - bulkUpdatePath: '/', - boardId: 1, - }); - vm = new Board({ propsData: { boardId: '1', @@ -30,94 +25,244 @@ describe('Board component', () => { id: 1, position: 0, title: 'test', - list_type: 'backlog', + list_type: listType, + collapsed, }), }, }).$mount(el); + }; + + const setUpTests = (done, opts = {}) => { + loadFixtures('boards/show.html'); + + gl.boardService = mockBoardService({ + boardsEndpoint: '/', + listsEndpoint: '/', + bulkUpdatePath: '/', + boardId: 1, + }); + + createComponent(opts); Vue.nextTick(done); - }); + }; + + const cleanUpTests = spy => { + if (spy) { + spy.calls.reset(); + } - afterEach(() => { vm.$destroy(); // remove the component from the DOM document.querySelector('.board').remove(); - localStorage.removeItem(`boards.${vm.boardId}.${vm.list.type}.expanded`); - }); + localStorage.removeItem(`${vm.uniqueKey}.expanded`); + }; - it('board is expandable when list type is backlog', () => { - expect(vm.$el.classList.contains('is-expandable')).toBe(true); - }); + describe('List', () => { + beforeEach(() => { + gl.boardService = mockBoardService({ + boardsEndpoint: '/', + listsEndpoint: '/', + bulkUpdatePath: '/', + boardId: 1, + }); + }); + + it('board is expandable when list type is closed', () => { + expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + }); + + it('board is expandable when list type is label', () => { + expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + }); - it('board is expandable when list type is closed', () => { - expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + it('board is not expandable when list type is blank', () => { + expect(new List({ id: 1, list_type: 'blank' }).isExpandable).toBe(false); + }); }); - it('board is expandable when list type is label', () => { - expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true); + describe('when clicking the header', () => { + beforeEach(done => { + setUpTests(done); + }); + + afterEach(() => { + cleanUpTests(); + }); + + it('does not collapse', done => { + vm.list.isExpanded = true; + vm.$el.querySelector('.board-header').click(); + + Vue.nextTick() + .then(() => { + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + }) + .then(done) + .catch(done.fail); + }); }); - it('board is not expandable when list type is blank', () => { - expect(new List({ id: 1, list_type: 'blank' }).isExpandable).toBe(false); + describe('when clicking the collapse icon', () => { + beforeEach(done => { + setUpTests(done); + }); + + afterEach(() => { + cleanUpTests(); + }); + + it('collapses', done => { + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) + .then(() => { + expect(vm.$el.classList.contains('is-collapsed')).toBe(true); + }) + .then(done) + .catch(done.fail); + }); }); - it('does not collapse when clicking header', done => { - vm.list.isExpanded = true; - vm.$el.querySelector('.board-header').click(); + describe('when clicking the expand icon', () => { + beforeEach(done => { + setUpTests(done); + }); - Vue.nextTick(() => { - expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + afterEach(() => { + cleanUpTests(); + }); + + it('expands', done => { + vm.list.isExpanded = false; - done(); + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) + .then(() => { + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + }) + .then(done) + .catch(done.fail); }); }); - it('collapses when clicking the collapse icon', done => { - vm.list.isExpanded = true; + describe('when collapsed is false', () => { + beforeEach(done => { + setUpTests(done); + }); - Vue.nextTick() - .then(() => { - vm.$el.querySelector('.board-title-caret').click(); - }) - .then(() => { - expect(vm.$el.classList.contains('is-collapsed')).toBe(true); - done(); - }) - .catch(done.fail); + afterEach(() => { + cleanUpTests(); + }); + + it('is expanded when collapsed is false', () => { + expect(vm.list.isExpanded).toBe(true); + expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + }); }); - it('expands when clicking the expand icon', done => { - vm.list.isExpanded = false; + describe('when list type is blank', () => { + beforeEach(done => { + setUpTests(done, { listType: 'blank' }); + }); + + afterEach(() => { + cleanUpTests(); + }); + + it('does not render add issue button when list type is blank', done => { + Vue.nextTick(() => { + expect(vm.$el.querySelector('.issue-count-badge-add-button')).toBeNull(); - Vue.nextTick() - .then(() => { - vm.$el.querySelector('.board-title-caret').click(); - }) - .then(() => { - expect(vm.$el.classList.contains('is-collapsed')).toBe(false); done(); - }) - .catch(done.fail); + }); + }); }); - it('is expanded when created', () => { - expect(vm.list.isExpanded).toBe(true); - expect(vm.$el.classList.contains('is-collapsed')).toBe(false); + describe('when list type is backlog', () => { + beforeEach(done => { + setUpTests(done); + }); + + afterEach(() => { + cleanUpTests(); + }); + + it('board is expandable', () => { + expect(vm.$el.classList.contains('is-expandable')).toBe(true); + }); }); - it('does render add issue button', () => { - expect(vm.$el.querySelector('.issue-count-badge-add-button')).not.toBeNull(); + describe('when logged in', () => { + let spy; + + beforeEach(done => { + spy = spyOn(List.prototype, 'update'); + setUpTests(done, { gon: { current_user_id: 1 } }); + }); + + afterEach(() => { + cleanUpTests(spy); + }); + + it('calls list update', done => { + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) + .then(() => { + expect(vm.list.update).toHaveBeenCalledTimes(1); + }) + .then(done) + .catch(done.fail); + }); }); - it('does not render add issue button when list type is blank', done => { - vm.list.type = 'blank'; + describe('when logged out', () => { + let spy; + beforeEach(done => { + spy = spyOn(List.prototype, 'update'); + setUpTests(done, { collapsed: false }); + }); + + afterEach(() => { + cleanUpTests(spy); + }); - Vue.nextTick(() => { - expect(vm.$el.querySelector('.issue-count-badge-add-button')).toBeNull(); + // can only be one or the other cant toggle window.gon.current_user_id states. + it('clicking on the caret does not call list update', done => { + Vue.nextTick() + .then(() => { + vm.$el.querySelector('.board-title-caret').click(); + }) + .then(() => { + expect(vm.list.update).toHaveBeenCalledTimes(0); + }) + .then(done) + .catch(done.fail); + }); + + it('sets expanded to be the opposite of its value when toggleExpanded is called', done => { + const expanded = true; + vm.list.isExpanded = expanded; + vm.toggleExpanded(); + + Vue.nextTick() + .then(() => { + expect(vm.list.isExpanded).toBe(!expanded); + expect(localStorage.getItem(`${vm.uniqueKey}.expanded`)).toBe(String(!expanded)); + }) + .then(done) + .catch(done.fail); + }); - done(); + it('does render add issue button', () => { + expect(vm.$el.querySelector('.issue-count-badge-add-button')).not.toBeNull(); }); }); }); diff --git a/spec/javascripts/boards/list_spec.js b/spec/javascripts/boards/list_spec.js index 15c9ff6dfb4..d01c37437ad 100644 --- a/spec/javascripts/boards/list_spec.js +++ b/spec/javascripts/boards/list_spec.js @@ -1,5 +1,7 @@ /* global List */ +/* global ListAssignee */ /* global ListIssue */ +/* global ListLabel */ import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; @@ -174,18 +176,29 @@ describe('List model', () => { Promise.resolve({ data: { id: 42, + subscribed: false, + assignable_labels_endpoint: '/issue/42/labels', + toggle_subscription_endpoint: '/issue/42/subscriptions', + issue_sidebar_endpoint: '/issue/42/sidebar_info', }, }), ); }); it('adds new issue to top of list', done => { + const user = new ListAssignee({ + id: 1, + name: 'testing 123', + username: 'test', + avatar: 'test_image', + }); + list.issues.push( new ListIssue({ title: 'Testing', id: _.random(10000), confidential: false, - labels: [list.label], + labels: [new ListLabel(list.label)], assignees: [], }), ); @@ -193,8 +206,9 @@ describe('List model', () => { title: 'new issue', id: _.random(10000), confidential: false, - labels: [list.label], - assignees: [], + labels: [new ListLabel(list.label)], + assignees: [user], + subscribed: false, }); list @@ -202,6 +216,12 @@ describe('List model', () => { .then(() => { expect(list.issues.length).toBe(2); expect(list.issues[0]).toBe(dummyIssue); + expect(list.issues[0].subscribed).toBe(false); + expect(list.issues[0].assignableLabelsEndpoint).toBe('/issue/42/labels'); + expect(list.issues[0].toggleSubscriptionEndpoint).toBe('/issue/42/subscriptions'); + expect(list.issues[0].sidebarInfoEndpoint).toBe('/issue/42/sidebar_info'); + expect(list.issues[0].labels).toBe(dummyIssue.labels); + expect(list.issues[0].assignees).toBe(dummyIssue.assignees); }) .then(done) .catch(done.fail); diff --git a/spec/javascripts/diffs/components/diff_content_spec.js b/spec/javascripts/diffs/components/diff_content_spec.js deleted file mode 100644 index 124bdeea45d..00000000000 --- a/spec/javascripts/diffs/components/diff_content_spec.js +++ /dev/null @@ -1,209 +0,0 @@ -import Vue from 'vue'; -import DiffContentComponent from '~/diffs/components/diff_content.vue'; -import { createStore } from 'ee_else_ce/mr_notes/stores'; -import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; -import { GREEN_BOX_IMAGE_URL, RED_BOX_IMAGE_URL } from 'spec/test_constants'; -import '~/behaviors/markdown/render_gfm'; -import diffFileMockData from '../mock_data/diff_file'; -import discussionsMockData from '../mock_data/diff_discussions'; -import { diffViewerModes } from '~/ide/constants'; - -describe('DiffContent', () => { - const Component = Vue.extend(DiffContentComponent); - let vm; - - beforeEach(() => { - const store = createStore(); - store.state.notes.noteableData = { - current_user: { - can_create_note: false, - }, - preview_note_path: 'path/to/preview', - }; - - vm = mountComponentWithStore(Component, { - store, - props: { - diffFile: JSON.parse(JSON.stringify(diffFileMockData)), - }, - }); - }); - - afterEach(() => { - vm.$destroy(); - }); - - describe('text based files', () => { - it('should render diff inline view', done => { - vm.$store.state.diffs.diffViewType = 'inline'; - - vm.$nextTick(() => { - expect(vm.$el.querySelectorAll('.js-diff-inline-view').length).toEqual(1); - - done(); - }); - }); - - it('should render diff parallel view', done => { - vm.$store.state.diffs.diffViewType = 'parallel'; - - vm.$nextTick(() => { - expect(vm.$el.querySelectorAll('.parallel').length).toEqual(18); - - done(); - }); - }); - - it('renders rendering more lines loading icon', done => { - vm.diffFile.renderingLines = true; - - vm.$nextTick(() => { - expect(vm.$el.querySelector('.loading-container')).not.toBe(null); - - done(); - }); - }); - }); - - describe('empty files', () => { - beforeEach(() => { - vm.diffFile.highlighted_diff_lines = []; - vm.diffFile.parallel_diff_lines = []; - }); - - it('should render a no preview message if viewer returns no preview', done => { - vm.diffFile.viewer.name = diffViewerModes.no_preview; - vm.$nextTick(() => { - const block = vm.$el.querySelector('.diff-viewer .nothing-here-block'); - - expect(block).not.toBe(null); - expect(block.textContent.trim()).toContain('No preview for this file type'); - - done(); - }); - }); - - it('should render a not diffable message if viewer returns not diffable', done => { - vm.diffFile.viewer.name = diffViewerModes.not_diffable; - vm.$nextTick(() => { - const block = vm.$el.querySelector('.diff-viewer .nothing-here-block'); - - expect(block).not.toBe(null); - expect(block.textContent.trim()).toContain( - 'This diff was suppressed by a .gitattributes entry', - ); - - done(); - }); - }); - - it('should not render multiple messages', done => { - vm.diffFile.b_mode = '100755'; - vm.diffFile.viewer.name = diffViewerModes.mode_changed; - - vm.$nextTick(() => { - expect(vm.$el.querySelectorAll('.nothing-here-block').length).toBe(1); - - done(); - }); - }); - - it('should not render diff table', done => { - vm.diffFile.viewer.name = diffViewerModes.no_preview; - vm.$nextTick(() => { - expect(vm.$el.querySelector('table')).toBe(null); - - done(); - }); - }); - }); - - describe('Non-Text diffs', () => { - beforeEach(() => { - vm.diffFile.viewer.name = 'image'; - }); - - describe('image diff', () => { - beforeEach(done => { - vm.diffFile.new_path = GREEN_BOX_IMAGE_URL; - vm.diffFile.new_sha = 'DEF'; - vm.diffFile.old_path = RED_BOX_IMAGE_URL; - vm.diffFile.old_sha = 'ABC'; - vm.diffFile.view_path = ''; - vm.diffFile.discussions = [{ ...discussionsMockData }]; - vm.$store.state.diffs.commentForms.push({ - fileHash: vm.diffFile.file_hash, - x: 10, - y: 20, - width: 100, - height: 200, - }); - - vm.$nextTick(done); - }); - - it('should have image diff view in place', () => { - expect(vm.$el.querySelectorAll('.js-diff-inline-view').length).toEqual(0); - - expect(vm.$el.querySelectorAll('.diff-viewer .image').length).toEqual(1); - }); - - it('renders image diff overlay', () => { - expect(vm.$el.querySelector('.image-diff-overlay')).not.toBe(null); - }); - - it('renders diff file discussions', () => { - expect(vm.$el.querySelectorAll('.discussion .note.timeline-entry').length).toEqual(5); - }); - - describe('handleSaveNote', () => { - it('dispatches handleSaveNote', () => { - spyOn(vm.$store, 'dispatch').and.stub(); - - vm.handleSaveNote('test'); - - expect(vm.$store.dispatch).toHaveBeenCalledWith('diffs/saveDiffDiscussion', { - note: 'test', - formData: { - noteableData: jasmine.anything(), - noteableType: jasmine.anything(), - diffFile: vm.diffFile, - positionType: 'image', - x: 10, - y: 20, - width: 100, - height: 200, - }, - }); - }); - }); - }); - - describe('file diff', () => { - it('should have download buttons in place', done => { - const el = vm.$el; - vm.diffFile.new_path = 'test.abc'; - vm.diffFile.new_sha = 'DEF'; - vm.diffFile.old_path = 'test.abc'; - vm.diffFile.old_sha = 'ABC'; - vm.diffFile.viewer.name = diffViewerModes.added; - - vm.$nextTick(() => { - expect(el.querySelectorAll('.js-diff-inline-view').length).toEqual(0); - - expect(el.querySelector('.deleted .file-info').textContent.trim()).toContain('test.abc'); - expect(el.querySelector('.deleted .btn.btn-default').textContent.trim()).toContain( - 'Download', - ); - - expect(el.querySelector('.added .file-info').textContent.trim()).toContain('test.abc'); - expect(el.querySelector('.added .btn.btn-default').textContent.trim()).toContain( - 'Download', - ); - - done(); - }); - }); - }); - }); -}); diff --git a/spec/javascripts/frequent_items/mock_data.js b/spec/javascripts/frequent_items/mock_data.js index cf3602f42d6..3ca5b4c7446 100644 --- a/spec/javascripts/frequent_items/mock_data.js +++ b/spec/javascripts/frequent_items/mock_data.js @@ -75,7 +75,7 @@ export const mockProject = { id: 1, name: 'GitLab Community Edition', namespace: 'gitlab-org / gitlab-ce', - webUrl: `${gl.TEST_HOST}/gitlab-org/gitlab-ce`, + webUrl: `${gl.TEST_HOST}/gitlab-org/gitlab-foss`, avatarUrl: null, }; @@ -83,7 +83,7 @@ export const mockRawProject = { id: 1, name: 'GitLab Community Edition', name_with_namespace: 'gitlab-org / gitlab-ce', - web_url: `${gl.TEST_HOST}/gitlab-org/gitlab-ce`, + web_url: `${gl.TEST_HOST}/gitlab-org/gitlab-foss`, avatar_url: null, }; @@ -92,7 +92,7 @@ export const mockFrequentProjects = [ id: 1, name: 'GitLab Community Edition', namespace: 'gitlab-org / gitlab-ce', - webUrl: `${gl.TEST_HOST}/gitlab-org/gitlab-ce`, + webUrl: `${gl.TEST_HOST}/gitlab-org/gitlab-foss`, avatarUrl: null, frequency: 1, lastAccessedOn: Date.now(), diff --git a/spec/javascripts/helpers/vue_test_utils_helper.js b/spec/javascripts/helpers/vue_test_utils_helper.js index 5b749b11246..1f5d8716dd3 100644 --- a/spec/javascripts/helpers/vue_test_utils_helper.js +++ b/spec/javascripts/helpers/vue_test_utils_helper.js @@ -1,5 +1,5 @@ // No new code should be added to this file. Instead, modify the // file this one re-exports from. For more detail about why, see: -// https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31349 +// https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/31349 export * from '../../frontend/helpers/vue_test_utils_helper'; diff --git a/spec/javascripts/ide/stores/actions/tree_spec.js b/spec/javascripts/ide/stores/actions/tree_spec.js index 674ecdc6764..0c3c4147501 100644 --- a/spec/javascripts/ide/stores/actions/tree_spec.js +++ b/spec/javascripts/ide/stores/actions/tree_spec.js @@ -73,7 +73,7 @@ describe('Multi-file store tree actions', () => { .dispatch('getFiles', basicCallParameters) .then(() => { // The populating of the tree is deferred for performance reasons. - // See this merge request for details: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/25700 + // See this merge request for details: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/25700 jasmine.clock().tick(1); }) .then(() => { diff --git a/spec/javascripts/image_diff/helpers/init_image_diff_spec.js b/spec/javascripts/image_diff/helpers/init_image_diff_spec.js new file mode 100644 index 00000000000..ba501d58965 --- /dev/null +++ b/spec/javascripts/image_diff/helpers/init_image_diff_spec.js @@ -0,0 +1,52 @@ +import initImageDiffHelper from '~/image_diff/helpers/init_image_diff'; +import ImageDiff from '~/image_diff/image_diff'; +import ReplacedImageDiff from '~/image_diff/replaced_image_diff'; + +describe('initImageDiff', () => { + let glCache; + let fileEl; + + beforeEach(() => { + window.gl = window.gl || (window.gl = {}); + glCache = window.gl; + fileEl = document.createElement('div'); + fileEl.innerHTML = ` + <div class="diff-file"></div> + `; + + spyOn(ReplacedImageDiff.prototype, 'init').and.callFake(() => {}); + spyOn(ImageDiff.prototype, 'init').and.callFake(() => {}); + }); + + afterEach(() => { + window.gl = glCache; + }); + + it('should initialize ImageDiff if js-single-image', () => { + const diffFileEl = fileEl.querySelector('.diff-file'); + diffFileEl.innerHTML = ` + <div class="js-single-image"> + </div> + `; + + const imageDiff = initImageDiffHelper.initImageDiff(fileEl, true, false); + + expect(ImageDiff.prototype.init).toHaveBeenCalled(); + expect(imageDiff.canCreateNote).toEqual(true); + expect(imageDiff.renderCommentBadge).toEqual(false); + }); + + it('should initialize ReplacedImageDiff if js-replaced-image', () => { + const diffFileEl = fileEl.querySelector('.diff-file'); + diffFileEl.innerHTML = ` + <div class="js-replaced-image"> + </div> + `; + + const replacedImageDiff = initImageDiffHelper.initImageDiff(fileEl, false, true); + + expect(ReplacedImageDiff.prototype.init).toHaveBeenCalled(); + expect(replacedImageDiff.canCreateNote).toEqual(false); + expect(replacedImageDiff.renderCommentBadge).toEqual(true); + }); +}); diff --git a/spec/javascripts/image_diff/helpers/utils_helper_spec.js b/spec/javascripts/image_diff/helpers/utils_helper_spec.js index 6f62ee3f93b..3b6378be883 100644 --- a/spec/javascripts/image_diff/helpers/utils_helper_spec.js +++ b/spec/javascripts/image_diff/helpers/utils_helper_spec.js @@ -1,6 +1,4 @@ import * as utilsHelper from '~/image_diff/helpers/utils_helper'; -import ImageDiff from '~/image_diff/image_diff'; -import ReplacedImageDiff from '~/image_diff/replaced_image_diff'; import ImageBadge from '~/image_diff/image_badge'; import * as mockData from '../mock_data'; @@ -151,53 +149,4 @@ describe('utilsHelper', () => { }); }); }); - - describe('initImageDiff', () => { - let glCache; - let fileEl; - - beforeEach(() => { - window.gl = window.gl || (window.gl = {}); - glCache = window.gl; - fileEl = document.createElement('div'); - fileEl.innerHTML = ` - <div class="diff-file"></div> - `; - - spyOn(ReplacedImageDiff.prototype, 'init').and.callFake(() => {}); - spyOn(ImageDiff.prototype, 'init').and.callFake(() => {}); - }); - - afterEach(() => { - window.gl = glCache; - }); - - it('should initialize ImageDiff if js-single-image', () => { - const diffFileEl = fileEl.querySelector('.diff-file'); - diffFileEl.innerHTML = ` - <div class="js-single-image"> - </div> - `; - - const imageDiff = utilsHelper.initImageDiff(fileEl, true, false); - - expect(ImageDiff.prototype.init).toHaveBeenCalled(); - expect(imageDiff.canCreateNote).toEqual(true); - expect(imageDiff.renderCommentBadge).toEqual(false); - }); - - it('should initialize ReplacedImageDiff if js-replaced-image', () => { - const diffFileEl = fileEl.querySelector('.diff-file'); - diffFileEl.innerHTML = ` - <div class="js-replaced-image"> - </div> - `; - - const replacedImageDiff = utilsHelper.initImageDiff(fileEl, false, true); - - expect(ReplacedImageDiff.prototype.init).toHaveBeenCalled(); - expect(replacedImageDiff.canCreateNote).toEqual(false); - expect(replacedImageDiff.renderCommentBadge).toEqual(true); - }); - }); }); diff --git a/spec/javascripts/image_diff/init_discussion_tab_spec.js b/spec/javascripts/image_diff/init_discussion_tab_spec.js index 7cacc45ab62..5eb87e1df25 100644 --- a/spec/javascripts/image_diff/init_discussion_tab_spec.js +++ b/spec/javascripts/image_diff/init_discussion_tab_spec.js @@ -1,5 +1,5 @@ import initDiscussionTab from '~/image_diff/init_discussion_tab'; -import imageDiffHelper from '~/image_diff/helpers/index'; +import initImageDiffHelper from '~/image_diff/helpers/init_image_diff'; describe('initDiscussionTab', () => { beforeEach(() => { @@ -12,7 +12,7 @@ describe('initDiscussionTab', () => { }); it('should pass canCreateNote as false to initImageDiff', done => { - spyOn(imageDiffHelper, 'initImageDiff').and.callFake((diffFileEl, canCreateNote) => { + spyOn(initImageDiffHelper, 'initImageDiff').and.callFake((diffFileEl, canCreateNote) => { expect(canCreateNote).toEqual(false); done(); }); @@ -21,7 +21,7 @@ describe('initDiscussionTab', () => { }); it('should pass renderCommentBadge as true to initImageDiff', done => { - spyOn(imageDiffHelper, 'initImageDiff').and.callFake( + spyOn(initImageDiffHelper, 'initImageDiff').and.callFake( (diffFileEl, canCreateNote, renderCommentBadge) => { expect(renderCommentBadge).toEqual(true); done(); @@ -32,9 +32,9 @@ describe('initDiscussionTab', () => { }); it('should call initImageDiff for each diffFileEls', () => { - spyOn(imageDiffHelper, 'initImageDiff').and.callFake(() => {}); + spyOn(initImageDiffHelper, 'initImageDiff').and.callFake(() => {}); initDiscussionTab(); - expect(imageDiffHelper.initImageDiff.calls.count()).toEqual(2); + expect(initImageDiffHelper.initImageDiff.calls.count()).toEqual(2); }); }); diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js index 2770743937e..c3d1440c34e 100644 --- a/spec/javascripts/issue_show/components/app_spec.js +++ b/spec/javascripts/issue_show/components/app_spec.js @@ -1,3 +1,5 @@ +/* eslint-disable no-unused-vars */ +import GLDropdown from '~/gl_dropdown'; import Vue from 'vue'; import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; @@ -52,6 +54,7 @@ describe('Issuable output', () => { markdownDocsPath: '/', projectNamespace: '/', projectPath: '/', + issuableTemplateNamesPath: '/issuable-templates-path', }, }).$mount(); @@ -129,11 +132,11 @@ describe('Issuable output', () => { }); it('does not update formState if form is already open', done => { - vm.openForm(); + vm.updateAndShowForm(); vm.state.titleText = 'testing 123'; - vm.openForm(); + vm.updateAndShowForm(); Vue.nextTick(() => { expect(vm.store.formState.title).not.toBe('testing 123'); @@ -284,7 +287,7 @@ describe('Issuable output', () => { }); }); - it('shows error mesage from backend if exists', done => { + it('shows error message from backend if exists', done => { const msg = 'Custom error message from backend'; spyOn(vm.service, 'updateIssuable').and.callFake( // eslint-disable-next-line prefer-promise-reject-errors @@ -405,20 +408,20 @@ describe('Issuable output', () => { }); }); - describe('open form', () => { + describe('updateAndShowForm', () => { it('shows locked warning if form is open & data is different', done => { vm.$nextTick() .then(() => { - vm.openForm(); + vm.updateAndShowForm(); vm.poll.makeRequest(); + + return new Promise(resolve => { + vm.$watch('formState.lockedWarningVisible', value => { + if (value) resolve(); + }); + }); }) - // Wait for the request - .then(vm.$nextTick) - // Wait for the successCallback to update the store state - .then(vm.$nextTick) - // Wait for the new state to flow to the Vue components - .then(vm.$nextTick) .then(() => { expect(vm.formState.lockedWarningVisible).toEqual(true); expect(vm.formState.lock_version).toEqual(1); @@ -429,6 +432,41 @@ describe('Issuable output', () => { }); }); + describe('requestTemplatesAndShowForm', () => { + beforeEach(() => { + spyOn(vm, 'updateAndShowForm'); + }); + + it('shows the form if template names request is successful', done => { + const mockData = [{ name: 'Bug' }]; + mock.onGet('/issuable-templates-path').reply(() => Promise.resolve([200, mockData])); + + vm.requestTemplatesAndShowForm() + .then(() => { + expect(vm.updateAndShowForm).toHaveBeenCalledWith(mockData); + }) + .then(done) + .catch(done.fail); + }); + + it('shows the form if template names request failed', done => { + mock + .onGet('/issuable-templates-path') + .reply(() => Promise.reject(new Error('something went wrong'))); + + vm.requestTemplatesAndShowForm() + .then(() => { + expect(document.querySelector('.flash-container .flash-text').textContent).toContain( + 'Error updating issue', + ); + + expect(vm.updateAndShowForm).toHaveBeenCalledWith(); + }) + .then(done) + .catch(done.fail); + }); + }); + describe('show inline edit button', () => { it('should not render by default', () => { expect(vm.$el.querySelector('.title-container .note-action-button')).toBeDefined(); diff --git a/spec/javascripts/jobs/components/artifacts_block_spec.js b/spec/javascripts/jobs/components/artifacts_block_spec.js index 58998d038e5..9cb56737f3e 100644 --- a/spec/javascripts/jobs/components/artifacts_block_spec.js +++ b/spec/javascripts/jobs/components/artifacts_block_spec.js @@ -18,9 +18,9 @@ describe('Artifacts block', () => { }; const nonExpiredArtifact = { - download_path: '/gitlab-org/gitlab-ce/-/jobs/98314558/artifacts/download', - browse_path: '/gitlab-org/gitlab-ce/-/jobs/98314558/artifacts/browse', - keep_path: '/gitlab-org/gitlab-ce/-/jobs/98314558/artifacts/keep', + download_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/download', + browse_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/browse', + keep_path: '/gitlab-org/gitlab-foss/-/jobs/98314558/artifacts/keep', expire_at: expireAt, expired: false, }; diff --git a/spec/javascripts/jobs/components/jobs_container_spec.js b/spec/javascripts/jobs/components/jobs_container_spec.js index fa3a2c4c266..119b18b7557 100644 --- a/spec/javascripts/jobs/components/jobs_container_spec.js +++ b/spec/javascripts/jobs/components/jobs_container_spec.js @@ -8,7 +8,7 @@ describe('Jobs List block', () => { const retried = { status: { - details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', + details_path: '/gitlab-org/gitlab-foss/pipelines/28029444', group: 'success', has_details: true, icon: 'status_success', @@ -24,7 +24,7 @@ describe('Jobs List block', () => { const active = { name: 'test', status: { - details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', + details_path: '/gitlab-org/gitlab-foss/pipelines/28029444', group: 'success', has_details: true, icon: 'status_success', @@ -40,7 +40,7 @@ describe('Jobs List block', () => { const job = { name: 'build', status: { - details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', + details_path: '/gitlab-org/gitlab-foss/pipelines/28029444', group: 'success', has_details: true, icon: 'status_success', diff --git a/spec/javascripts/jobs/components/log/duration_badge_spec.js b/spec/javascripts/jobs/components/log/duration_badge_spec.js deleted file mode 100644 index 2ac34e78909..00000000000 --- a/spec/javascripts/jobs/components/log/duration_badge_spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import DurationBadge from '~/jobs/components/log/duration_badge.vue'; - -describe('Job Log Duration Badge', () => { - let wrapper; - - const data = { - duration: '00:30:01', - }; - - const createComponent = (props = {}) => { - wrapper = shallowMount(DurationBadge, { - sync: false, - propsData: { - ...props, - }, - }); - }; - - beforeEach(() => { - createComponent(data); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders provided duration', () => { - expect(wrapper.text()).toBe(data.duration); - }); -}); diff --git a/spec/javascripts/jobs/components/log/line_header_spec.js b/spec/javascripts/jobs/components/log/line_header_spec.js deleted file mode 100644 index 2d2f92fad9d..00000000000 --- a/spec/javascripts/jobs/components/log/line_header_spec.js +++ /dev/null @@ -1,95 +0,0 @@ -import { mount } from '@vue/test-utils'; -import LineHeader from '~/jobs/components/log/line_header.vue'; -import LineNumber from '~/jobs/components/log/line_number.vue'; -import DurationBadge from '~/jobs/components/log/duration_badge.vue'; - -describe('Job Log Header Line', () => { - let wrapper; - - const data = { - line: { - content: [ - { - text: 'Running with gitlab-runner 12.1.0 (de7731dd)', - style: 'term-fg-l-green', - }, - ], - lineNumber: 0, - }, - isClosed: true, - path: '/jashkenas/underscore/-/jobs/335', - }; - - const createComponent = (props = {}) => { - wrapper = mount(LineHeader, { - sync: false, - propsData: { - ...props, - }, - }); - }; - - afterEach(() => { - wrapper.destroy(); - }); - - describe('line', () => { - beforeEach(() => { - createComponent(data); - }); - - it('renders the line number component', () => { - expect(wrapper.contains(LineNumber)).toBe(true); - }); - - it('renders a span the provided text', () => { - expect(wrapper.find('span').text()).toBe(data.line.content[0].text); - }); - - it('renders the provided style as a class attribute', () => { - expect(wrapper.find('span').classes()).toContain(data.line.content[0].style); - }); - }); - - describe('when isCloses is true', () => { - beforeEach(() => { - createComponent({ ...data, isClosed: true }); - }); - - it('sets icon name to be angle-right', () => { - expect(wrapper.vm.iconName).toEqual('angle-right'); - }); - }); - - describe('when isCloses is false', () => { - beforeEach(() => { - createComponent({ ...data, isClosed: false }); - }); - - it('sets icon name to be angle-down', () => { - expect(wrapper.vm.iconName).toEqual('angle-down'); - }); - }); - - describe('on click', () => { - beforeEach(() => { - createComponent(data); - }); - - it('emits toggleLine event', () => { - wrapper.trigger('click'); - - expect(wrapper.emitted().toggleLine.length).toBe(1); - }); - }); - - describe('with duration', () => { - beforeEach(() => { - createComponent(Object.assign({}, data, { duration: '00:10' })); - }); - - it('renders the duration badge', () => { - expect(wrapper.contains(DurationBadge)).toBe(true); - }); - }); -}); diff --git a/spec/javascripts/jobs/components/log/line_number_spec.js b/spec/javascripts/jobs/components/log/line_number_spec.js deleted file mode 100644 index fcf2edf9159..00000000000 --- a/spec/javascripts/jobs/components/log/line_number_spec.js +++ /dev/null @@ -1,40 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import LineNumber from '~/jobs/components/log/line_number.vue'; - -describe('Job Log Line Number', () => { - let wrapper; - - const data = { - lineNumber: 0, - path: '/jashkenas/underscore/-/jobs/335', - }; - - const createComponent = (props = {}) => { - wrapper = shallowMount(LineNumber, { - sync: false, - propsData: { - ...props, - }, - }); - }; - - beforeEach(() => { - createComponent(data); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders incremented lineNunber by 1', () => { - expect(wrapper.text()).toBe('1'); - }); - - it('renders link with lineNumber as an ID', () => { - expect(wrapper.attributes().id).toBe('L1'); - }); - - it('links to the provided path with line number as anchor', () => { - expect(wrapper.attributes().href).toBe(`${data.path}#L1`); - }); -}); diff --git a/spec/javascripts/jobs/components/log/line_spec.js b/spec/javascripts/jobs/components/log/line_spec.js deleted file mode 100644 index ea593e3c39a..00000000000 --- a/spec/javascripts/jobs/components/log/line_spec.js +++ /dev/null @@ -1,49 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import Line from '~/jobs/components/log/line.vue'; -import LineNumber from '~/jobs/components/log/line_number.vue'; - -describe('Job Log Line', () => { - let wrapper; - - const data = { - line: { - content: [ - { - text: 'Running with gitlab-runner 12.1.0 (de7731dd)', - style: 'term-fg-l-green', - }, - ], - lineNumber: 0, - }, - path: '/jashkenas/underscore/-/jobs/335', - }; - - const createComponent = (props = {}) => { - wrapper = shallowMount(Line, { - sync: false, - propsData: { - ...props, - }, - }); - }; - - beforeEach(() => { - createComponent(data); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - it('renders the line number component', () => { - expect(wrapper.contains(LineNumber)).toBe(true); - }); - - it('renders a span the provided text', () => { - expect(wrapper.find('span').text()).toBe(data.line.content[0].text); - }); - - it('renders the provided style as a class attribute', () => { - expect(wrapper.find('span').classes()).toContain(data.line.content[0].style); - }); -}); diff --git a/spec/javascripts/jobs/components/log/log_spec.js b/spec/javascripts/jobs/components/log/log_spec.js deleted file mode 100644 index 469bbf6714d..00000000000 --- a/spec/javascripts/jobs/components/log/log_spec.js +++ /dev/null @@ -1,77 +0,0 @@ -import { mount, createLocalVue } from '@vue/test-utils'; -import Vuex from 'vuex'; -import { logLinesParser } from '~/jobs/store/utils'; -import Log from '~/jobs/components/log/log.vue'; -import { jobLog } from './mock_data'; - -describe('Job Log', () => { - let wrapper; - let actions; - let state; - let store; - - const localVue = createLocalVue(); - localVue.use(Vuex); - - const createComponent = () => { - wrapper = mount(Log, { - sync: false, - localVue, - store, - }); - }; - - beforeEach(() => { - actions = { - toggleCollapsibleLine: () => {}, - }; - - state = { - trace: logLinesParser(jobLog), - traceEndpoint: 'jobs/id', - }; - - store = new Vuex.Store({ - actions, - state, - }); - - createComponent(); - }); - - afterEach(() => { - wrapper.destroy(); - }); - - describe('line numbers', () => { - it('renders a line number for each open line', () => { - expect(wrapper.find('#L1').text()).toBe('1'); - expect(wrapper.find('#L2').text()).toBe('2'); - expect(wrapper.find('#L3').text()).toBe('3'); - }); - - it('links to the provided path and correct line number', () => { - expect(wrapper.find('#L1').attributes('href')).toBe(`${state.traceEndpoint}#L1`); - }); - }); - - describe('collapsible sections', () => { - it('renders a clickable header section', () => { - expect(wrapper.find('.collapsible-line').attributes('role')).toBe('button'); - }); - - it('renders an icon with the closed state', () => { - expect(wrapper.find('.collapsible-line svg').classes()).toContain('ic-angle-right'); - }); - - describe('on click header section', () => { - it('calls toggleCollapsibleLine', () => { - spyOn(wrapper.vm, 'toggleCollapsibleLine').and.callThrough(); - - wrapper.find('.collapsible-line').trigger('click'); - - expect(wrapper.vm.toggleCollapsibleLine).toHaveBeenCalled(); - }); - }); - }); -}); diff --git a/spec/javascripts/jobs/components/log/mock_data.js b/spec/javascripts/jobs/components/log/mock_data.js deleted file mode 100644 index 54a6d31b278..00000000000 --- a/spec/javascripts/jobs/components/log/mock_data.js +++ /dev/null @@ -1,26 +0,0 @@ -// eslint-disable-next-line import/prefer-default-export -export const jobLog = [ - { - offset: 1000, - content: [{ text: 'Running with gitlab-runner 12.1.0 (de7731dd)' }], - }, - { - offset: 1001, - content: [{ text: ' on docker-auto-scale-com 8a6210b8' }], - }, - { - offset: 1002, - content: [ - { - text: 'Using Docker executor with image dev.gitlab.org3', - }, - ], - sections: ['prepare-executor'], - section_header: true, - }, - { - offset: 1003, - content: [{ text: 'Starting service postgres:9.6.14 ...', style: 'text-green' }], - sections: ['prepare-executor'], - }, -]; diff --git a/spec/javascripts/jobs/components/stages_dropdown_spec.js b/spec/javascripts/jobs/components/stages_dropdown_spec.js index 86b7a8d7848..a34337310d6 100644 --- a/spec/javascripts/jobs/components/stages_dropdown_spec.js +++ b/spec/javascripts/jobs/components/stages_dropdown_spec.js @@ -11,7 +11,7 @@ describe('Stages Dropdown', () => { id: 28029444, details: { status: { - details_path: '/gitlab-org/gitlab-ce/pipelines/28029444', + details_path: '/gitlab-org/gitlab-foss/pipelines/28029444', group: 'success', has_details: true, icon: 'status_success', diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js index 3a53ecacb88..b424cbc866d 100644 --- a/spec/javascripts/merge_request_tabs_spec.js +++ b/spec/javascripts/merge_request_tabs_spec.js @@ -1,4 +1,4 @@ -/* eslint-disable no-var, object-shorthand */ +/* eslint-disable no-var */ import $ from 'jquery'; import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; @@ -28,7 +28,7 @@ describe('MergeRequestTabs', function() { beforeEach(function() { mrPageMock = initMrPage(); - this.class = new MergeRequestTabs({ stubLocation: stubLocation }); + this.class = new MergeRequestTabs({ stubLocation }); setLocation(); this.spies = { @@ -57,10 +57,10 @@ describe('MergeRequestTabs', function() { metaKey: false, ctrlKey: false, which: 1, - stopImmediatePropagation: function() {}, - preventDefault: function() {}, + stopImmediatePropagation() {}, + preventDefault() {}, currentTarget: { - getAttribute: function(attr) { + getAttribute(attr) { return attr === 'href' ? tabUrl : null; }, }, diff --git a/spec/javascripts/monitoring/charts/time_series_spec.js b/spec/javascripts/monitoring/charts/time_series_spec.js index d145a64e8d0..f6a5ed03c0d 100644 --- a/spec/javascripts/monitoring/charts/time_series_spec.js +++ b/spec/javascripts/monitoring/charts/time_series_spec.js @@ -23,7 +23,6 @@ describe('Time series component', () => { store = createStore(); store.commit(`monitoringDashboard/${types.RECEIVE_METRICS_DATA_SUCCESS}`, MonitoringMock.data); store.commit(`monitoringDashboard/${types.RECEIVE_DEPLOYMENTS_DATA_SUCCESS}`, deploymentData); - store.dispatch('monitoringDashboard/setFeatureFlags', { exportMetricsToCsvEnabled: true }); [mockGraphData] = store.state.monitoringDashboard.groups[0].metrics; makeTimeSeriesChart = (graphData, type) => @@ -61,19 +60,6 @@ describe('Time series component', () => { expect(timeSeriesChart.find('.js-graph-widgets').text()).toBe(mockWidgets); }); - describe('when exportMetricsToCsvEnabled is disabled', () => { - beforeEach(() => { - store.dispatch('monitoringDashboard/setFeatureFlags', { exportMetricsToCsvEnabled: false }); - }); - - it('does not render the Download CSV button', done => { - timeSeriesChart.vm.$nextTick(() => { - expect(timeSeriesChart.contains('glbutton-stub')).toBe(false); - done(); - }); - }); - }); - describe('methods', () => { describe('formatTooltipText', () => { const mockDate = deploymentData[0].created_at; @@ -234,24 +220,6 @@ describe('Time series component', () => { expect(timeSeriesChart.vm.yAxisLabel).toBe('CPU'); }); }); - - describe('csvText', () => { - it('converts data from json to csv', () => { - const header = `timestamp,${mockGraphData.y_label}`; - const data = mockGraphData.queries[0].result[0].values; - const firstRow = `${data[0][0]},${data[0][1]}`; - - expect(timeSeriesChart.vm.csvText).toMatch(`^${header}\r\n${firstRow}`); - }); - }); - - describe('downloadLink', () => { - it('produces a link to download metrics as csv', () => { - const link = timeSeriesChart.vm.downloadLink; - - expect(link).toContain('blob:'); - }); - }); }); afterEach(() => { diff --git a/spec/javascripts/monitoring/components/dashboard_spec.js b/spec/javascripts/monitoring/components/dashboard_spec.js index 15e41e2fe93..6ce32d21f45 100644 --- a/spec/javascripts/monitoring/components/dashboard_spec.js +++ b/spec/javascripts/monitoring/components/dashboard_spec.js @@ -378,7 +378,7 @@ describe('Dashboard', () => { }); }); - // https://gitlab.com/gitlab-org/gitlab-ce/issues/66922 + // https://gitlab.com/gitlab-org/gitlab-foss/issues/66922 // eslint-disable-next-line jasmine/no-disabled-tests xdescribe('link to chart', () => { let wrapper; diff --git a/spec/javascripts/monitoring/store/mutations_spec.js b/spec/javascripts/monitoring/store/mutations_spec.js index 43776b1b7f2..bdb68a80a8a 100644 --- a/spec/javascripts/monitoring/store/mutations_spec.js +++ b/spec/javascripts/monitoring/store/mutations_spec.js @@ -115,14 +115,14 @@ describe('Monitoring mutations', () => { environmentsEndpoint: 'environments.json', deploymentsEndpoint: 'deployments.json', dashboardEndpoint: 'dashboard.json', - projectPath: '/gitlab-org/gitlab-ce', + projectPath: '/gitlab-org/gitlab-foss', }); expect(stateCopy.metricsEndpoint).toEqual('additional_metrics.json'); expect(stateCopy.environmentsEndpoint).toEqual('environments.json'); expect(stateCopy.deploymentsEndpoint).toEqual('deployments.json'); expect(stateCopy.dashboardEndpoint).toEqual('dashboard.json'); - expect(stateCopy.projectPath).toEqual('/gitlab-org/gitlab-ce'); + expect(stateCopy.projectPath).toEqual('/gitlab-org/gitlab-foss'); }); }); diff --git a/spec/javascripts/notes/components/note_awards_list_spec.js b/spec/javascripts/notes/components/note_awards_list_spec.js index 6a6a810acff..ede541a5247 100644 --- a/spec/javascripts/notes/components/note_awards_list_spec.js +++ b/spec/javascripts/notes/components/note_awards_list_spec.js @@ -32,7 +32,7 @@ describe('note_awards_list component', () => { noteAuthorId: 2, noteId: '545', canAwardEmoji: true, - toggleAwardPath: '/gitlab-org/gitlab-ce/notes/545/toggle_award_emoji', + toggleAwardPath: '/gitlab-org/gitlab-foss/notes/545/toggle_award_emoji', }, }).$mount(); }); @@ -72,7 +72,7 @@ describe('note_awards_list component', () => { noteAuthorId: 2, noteId: '545', canAwardEmoji: false, - toggleAwardPath: '/gitlab-org/gitlab-ce/notes/545/toggle_award_emoji', + toggleAwardPath: '/gitlab-org/gitlab-foss/notes/545/toggle_award_emoji', }, }).$mount(); }); diff --git a/spec/javascripts/notes/components/note_form_spec.js b/spec/javascripts/notes/components/note_form_spec.js index b632ee6736d..96aa7824cec 100644 --- a/spec/javascripts/notes/components/note_form_spec.js +++ b/spec/javascripts/notes/components/note_form_spec.js @@ -17,7 +17,7 @@ describe('issue_note_form component', () => { return shallowMount(NoteForm, { store, propsData: props, - // see https://gitlab.com/gitlab-org/gitlab-ce/issues/56317 for the following + // see https://gitlab.com/gitlab-org/gitlab-foss/issues/56317 for the following localVue, sync: false, }); diff --git a/spec/javascripts/notes/mock_data.js b/spec/javascripts/notes/mock_data.js index 98a9150d05d..dc914ce8355 100644 --- a/spec/javascripts/notes/mock_data.js +++ b/spec/javascripts/notes/mock_data.js @@ -1,11 +1,11 @@ // Copied to ee/spec/frontend/notes/mock_data.js export const notesDataMock = { - discussionsPath: '/gitlab-org/gitlab-ce/issues/26/discussions.json', + discussionsPath: '/gitlab-org/gitlab-foss/issues/26/discussions.json', lastFetchedAt: 1501862675, markdownDocsPath: '/help/user/markdown', newSessionPath: '/users/sign_in?redirect_to_referer=yes', - notesPath: '/gitlab-org/gitlab-ce/noteable/issue/98/notes', + notesPath: '/gitlab-org/gitlab-foss/noteable/issue/98/notes', quickActionsDocsPath: '/help/user/project/quick_actions', registerPath: '/users/sign_in?redirect_to_referer=yes#register-pane', prerenderedNotesCount: 1, @@ -28,7 +28,7 @@ export const noteableDataMock = { author_id: 1, branch_name: null, confidential: false, - create_note_path: '/gitlab-org/gitlab-ce/notes?target_id=98&target_type=issue', + create_note_path: '/gitlab-org/gitlab-foss/notes?target_id=98&target_type=issue', created_at: '2017-02-07T10:11:18.395Z', current_user: { can_create_note: true, @@ -46,7 +46,7 @@ export const noteableDataMock = { milestone: null, milestone_id: null, moved_to_id: null, - preview_note_path: '/gitlab-org/gitlab-ce/preview_markdown?target_id=98&target_type=Issue', + preview_note_path: '/gitlab-org/gitlab-foss/preview_markdown?target_id=98&target_type=Issue', project_id: 2, state: 'opened', time_estimate: 0, @@ -55,7 +55,7 @@ export const noteableDataMock = { noteable_note_url: '/group/project/merge_requests/1#note_1', updated_at: '2017-08-04T09:53:01.226Z', updated_by_id: 1, - web_url: '/gitlab-org/gitlab-ce/issues/26', + web_url: '/gitlab-org/gitlab-foss/issues/26', noteableType: 'issue', }; @@ -100,12 +100,12 @@ export const individualNote = { { name: 'baseball', user: { id: 1, name: 'Root', username: 'root' } }, { name: 'art', user: { id: 1, name: 'Root', username: 'root' } }, ], - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1390/toggle_award_emoji', noteable_note_url: '/group/project/merge_requests/1#note_1', note_url: '/group/project/merge_requests/1#note_1', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1390', + path: '/gitlab-org/gitlab-foss/notes/1390', }, ], reply_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd', @@ -160,12 +160,12 @@ export const note = { }, }, ], - toggle_award_path: '/gitlab-org/gitlab-ce/notes/546/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/546/toggle_award_emoji', note_url: '/group/project/merge_requests/1#note_1', noteable_note_url: '/group/project/merge_requests/1#note_1', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F7%23note_546&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/546', + path: '/gitlab-org/gitlab-foss/notes/546', }; export const discussionMock = { @@ -206,10 +206,10 @@ export const discussionMock = { emoji_awardable: true, award_emoji: [], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1395/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1395/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1395&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1395', + path: '/gitlab-org/gitlab-foss/notes/1395', }, { id: '1396', @@ -252,11 +252,11 @@ export const discussionMock = { discussion_id: '9e3bd2f71a01de45fd166e6719eb380ad9f270b1', emoji_awardable: true, award_emoji: [], - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1396/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1396/toggle_award_emoji', noteable_note_url: '/group/project/merge_requests/1#note_1', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1396&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1396', + path: '/gitlab-org/gitlab-foss/notes/1396', }, { id: '1437', @@ -300,10 +300,10 @@ export const discussionMock = { emoji_awardable: true, award_emoji: [], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1437/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1437/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1437&user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1437', + path: '/gitlab-org/gitlab-foss/notes/1437', }, ], individual_note: false, @@ -344,14 +344,14 @@ export const loggedOutnoteableData = { due_date: null, moved_to_id: null, project_id: 2, - web_url: '/gitlab-org/gitlab-ce/issues/26', + web_url: '/gitlab-org/gitlab-foss/issues/26', current_user: { can_create_note: false, can_update: false, }, noteable_note_url: '/group/project/merge_requests/1#note_1', - create_note_path: '/gitlab-org/gitlab-ce/notes?target_id=98&target_type=issue', - preview_note_path: '/gitlab-org/gitlab-ce/preview_markdown?target_id=98&target_type=Issue', + create_note_path: '/gitlab-org/gitlab-foss/notes?target_id=98&target_type=issue', + preview_note_path: '/gitlab-org/gitlab-foss/preview_markdown?target_id=98&target_type=Issue', }; export const collapseNotesMock = [ @@ -429,7 +429,7 @@ export const collapseNotesMock = [ export const INDIVIDUAL_NOTE_RESPONSE_MAP = { GET: { - '/gitlab-org/gitlab-ce/issues/26/discussions.json': [ + '/gitlab-org/gitlab-foss/issues/26/discussions.json': [ { id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd', reply_id: '0fb4e0e3f9276e55ff32eb4195add694aece4edd', @@ -484,10 +484,10 @@ export const INDIVIDUAL_NOTE_RESPONSE_MAP = { }, ], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1390/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1390/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1390\u0026user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1390', + path: '/gitlab-org/gitlab-foss/notes/1390', }, ], individual_note: true, @@ -529,22 +529,22 @@ export const INDIVIDUAL_NOTE_RESPONSE_MAP = { emoji_awardable: true, award_emoji: [], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1391/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1391/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F26%23note_1391\u0026user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1391', + path: '/gitlab-org/gitlab-foss/notes/1391', }, ], individual_note: true, }, ], - '/gitlab-org/gitlab-ce/noteable/issue/98/notes': { + '/gitlab-org/gitlab-foss/noteable/issue/98/notes': { last_fetched_at: 1512900838, notes: [], }, }, PUT: { - '/gitlab-org/gitlab-ce/notes/1471': { + '/gitlab-org/gitlab-foss/notes/1471': { commands_changes: null, valid: true, id: '1471', @@ -584,10 +584,10 @@ export const INDIVIDUAL_NOTE_RESPONSE_MAP = { emoji_awardable: true, award_emoji: [], noteable_note_url: '/group/project/merge_requests/1#note_1', - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1471/toggle_award_emoji', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471\u0026user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1471', + path: '/gitlab-org/gitlab-foss/notes/1471', }, }, }; @@ -596,7 +596,7 @@ export const DISCUSSION_NOTE_RESPONSE_MAP = { ...INDIVIDUAL_NOTE_RESPONSE_MAP, GET: { ...INDIVIDUAL_NOTE_RESPONSE_MAP.GET, - '/gitlab-org/gitlab-ce/issues/26/discussions.json': [ + '/gitlab-org/gitlab-foss/issues/26/discussions.json': [ { id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052', reply_id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052', @@ -634,11 +634,11 @@ export const DISCUSSION_NOTE_RESPONSE_MAP = { discussion_id: 'a3ed36e29b1957efb3b68c53e2d7a2b24b1df052', emoji_awardable: true, award_emoji: [], - toggle_award_path: '/gitlab-org/gitlab-ce/notes/1471/toggle_award_emoji', + toggle_award_path: '/gitlab-org/gitlab-foss/notes/1471/toggle_award_emoji', noteable_note_url: '/group/project/merge_requests/1#note_1', report_abuse_path: '/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F29%23note_1471\u0026user_id=1', - path: '/gitlab-org/gitlab-ce/notes/1471', + path: '/gitlab-org/gitlab-foss/notes/1471', }, ], individual_note: false, diff --git a/spec/javascripts/performance_bar/components/request_selector_spec.js b/spec/javascripts/performance_bar/components/request_selector_spec.js index a272e03c0e1..3c2169de877 100644 --- a/spec/javascripts/performance_bar/components/request_selector_spec.js +++ b/spec/javascripts/performance_bar/components/request_selector_spec.js @@ -7,11 +7,11 @@ describe('request selector', () => { { id: '123', url: 'https://gitlab.com/' }, { id: '456', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1', + url: 'https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/1', }, { id: '789', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/1.json?serializer=widget', + url: 'https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/1.json?serializer=widget', }, ]; diff --git a/spec/javascripts/pipelines/graph/graph_component_spec.js b/spec/javascripts/pipelines/graph/graph_component_spec.js index 96a2d5f62fa..98e92aff25f 100644 --- a/spec/javascripts/pipelines/graph/graph_component_spec.js +++ b/spec/javascripts/pipelines/graph/graph_component_spec.js @@ -7,6 +7,12 @@ describe('graph component', () => { const GraphComponent = Vue.extend(graphComponent); let component; + beforeEach(() => { + setFixtures(` + <div class="layout-page"></div> + `); + }); + afterEach(() => { component.$destroy(); }); diff --git a/spec/javascripts/pipelines/mock_data.js b/spec/javascripts/pipelines/mock_data.js index 03ead6cd8ba..f876987cd88 100644 --- a/spec/javascripts/pipelines/mock_data.js +++ b/spec/javascripts/pipelines/mock_data.js @@ -15,7 +15,7 @@ export const pipelineWithStages = { source: 'push', created_at: '2018-04-11T14:04:53.881Z', updated_at: '2018-04-11T14:05:00.792Z', - path: '/gitlab-org/gitlab-ee/pipelines/20333396', + path: '/gitlab-org/gitlab/pipelines/20333396', flags: { latest: true, stuck: false, @@ -32,7 +32,7 @@ export const pipelineWithStages = { label: 'running', group: 'running', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396', + details_path: '/gitlab-org/gitlab/pipelines/20333396', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_running-2eb56be2871937954b2ba6d6f4ee9fdf7e5e1c146ac45f7be98119ccaca1aca9.ico', }, @@ -48,12 +48,12 @@ export const pipelineWithStages = { label: 'skipped', group: 'skipped', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#build', + details_path: '/gitlab-org/gitlab/pipelines/20333396#build', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_skipped-a2eee568a5bffdb494050c7b62dde241de9189280836288ac8923d369f16222d.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#build', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=build', + path: '/gitlab-org/gitlab/pipelines/20333396#build', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=build', }, { name: 'prepare', @@ -64,12 +64,12 @@ export const pipelineWithStages = { label: 'passed', group: 'success', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#prepare', + details_path: '/gitlab-org/gitlab/pipelines/20333396#prepare', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_success-26f59841becbef8c6fe414e9e74471d8bfd6a91b5855c19fe7f5923a40a7da47.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#prepare', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=prepare', + path: '/gitlab-org/gitlab/pipelines/20333396#prepare', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=prepare', }, { name: 'test', @@ -80,12 +80,12 @@ export const pipelineWithStages = { label: 'running', group: 'running', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#test', + details_path: '/gitlab-org/gitlab/pipelines/20333396#test', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_running-2eb56be2871937954b2ba6d6f4ee9fdf7e5e1c146ac45f7be98119ccaca1aca9.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#test', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=test', + path: '/gitlab-org/gitlab/pipelines/20333396#test', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=test', }, { name: 'post-test', @@ -96,12 +96,12 @@ export const pipelineWithStages = { label: 'created', group: 'created', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#post-test', + details_path: '/gitlab-org/gitlab/pipelines/20333396#post-test', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_created-e997aa0b7db73165df8a9d6803932b18d7b7cc37d604d2d96e378fea2dba9c5f.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#post-test', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=post-test', + path: '/gitlab-org/gitlab/pipelines/20333396#post-test', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=post-test', }, { name: 'pages', @@ -112,12 +112,12 @@ export const pipelineWithStages = { label: 'created', group: 'created', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#pages', + details_path: '/gitlab-org/gitlab/pipelines/20333396#pages', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_created-e997aa0b7db73165df8a9d6803932b18d7b7cc37d604d2d96e378fea2dba9c5f.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#pages', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=pages', + path: '/gitlab-org/gitlab/pipelines/20333396#pages', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=pages', }, { name: 'post-cleanup', @@ -128,12 +128,12 @@ export const pipelineWithStages = { label: 'created', group: 'created', has_details: true, - details_path: '/gitlab-org/gitlab-ee/pipelines/20333396#post-cleanup', + details_path: '/gitlab-org/gitlab/pipelines/20333396#post-cleanup', favicon: 'https://assets.gitlab-static.net/assets/ci_favicons/favicon_status_created-e997aa0b7db73165df8a9d6803932b18d7b7cc37d604d2d96e378fea2dba9c5f.ico', }, - path: '/gitlab-org/gitlab-ee/pipelines/20333396#post-cleanup', - dropdown_path: '/gitlab-org/gitlab-ee/pipelines/20333396/stage.json?stage=post-cleanup', + path: '/gitlab-org/gitlab/pipelines/20333396#post-cleanup', + dropdown_path: '/gitlab-org/gitlab/pipelines/20333396/stage.json?stage=post-cleanup', }, ], artifacts: [ @@ -141,144 +141,144 @@ export const pipelineWithStages = { name: 'gitlab:assets:compile', expired: false, expire_at: '2018-05-12T14:22:54.730Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411438/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411438/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411438/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411438/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411438/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411438/artifacts/browse', }, { name: 'rspec-mysql 12 28', expired: false, expire_at: '2018-05-12T14:22:45.136Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411397/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411397/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411397/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411397/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411397/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411397/artifacts/browse', }, { name: 'rspec-mysql 6 28', expired: false, expire_at: '2018-05-12T14:22:41.523Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411391/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411391/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411391/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411391/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411391/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411391/artifacts/browse', }, { name: 'rspec-pg geo 0 1', expired: false, expire_at: '2018-05-12T14:22:13.287Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411353/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411353/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411353/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411353/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411353/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411353/artifacts/browse', }, { name: 'rspec-mysql 0 28', expired: false, expire_at: '2018-05-12T14:22:06.834Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411385/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411385/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411385/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411385/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411385/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411385/artifacts/browse', }, { name: 'spinach-mysql 0 2', expired: false, expire_at: '2018-05-12T14:21:51.409Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411423/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411423/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411423/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411423/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411423/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411423/artifacts/browse', }, { name: 'karma', expired: false, expire_at: '2018-05-12T14:21:20.934Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411440/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411440/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411440/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411440/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411440/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411440/artifacts/browse', }, { name: 'spinach-pg 0 2', expired: false, expire_at: '2018-05-12T14:20:01.028Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411419/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411419/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411419/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411419/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411419/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411419/artifacts/browse', }, { name: 'spinach-pg 1 2', expired: false, expire_at: '2018-05-12T14:19:04.336Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411421/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411421/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411421/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411421/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411421/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411421/artifacts/browse', }, { name: 'sast', expired: null, expire_at: null, - path: '/gitlab-org/gitlab-ee/-/jobs/62411442/artifacts/download', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411442/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411442/artifacts/download', + browse_path: '/gitlab-org/gitlab/-/jobs/62411442/artifacts/browse', }, { name: 'code_quality', expired: false, expire_at: '2018-04-18T14:16:24.484Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411441/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411441/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411441/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411441/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411441/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411441/artifacts/browse', }, { name: 'cache gems', expired: null, expire_at: null, - path: '/gitlab-org/gitlab-ee/-/jobs/62411447/artifacts/download', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411447/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411447/artifacts/download', + browse_path: '/gitlab-org/gitlab/-/jobs/62411447/artifacts/browse', }, { name: 'dependency_scanning', expired: null, expire_at: null, - path: '/gitlab-org/gitlab-ee/-/jobs/62411443/artifacts/download', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411443/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411443/artifacts/download', + browse_path: '/gitlab-org/gitlab/-/jobs/62411443/artifacts/browse', }, { name: 'compile-assets', expired: false, expire_at: '2018-04-18T14:12:07.638Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411334/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411334/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411334/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411334/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411334/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411334/artifacts/browse', }, { name: 'setup-test-env', expired: false, expire_at: '2018-04-18T14:10:27.024Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411336/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411336/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411336/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411336/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411336/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411336/artifacts/browse', }, { name: 'retrieve-tests-metadata', expired: false, expire_at: '2018-05-12T14:06:35.926Z', - path: '/gitlab-org/gitlab-ee/-/jobs/62411333/artifacts/download', - keep_path: '/gitlab-org/gitlab-ee/-/jobs/62411333/artifacts/keep', - browse_path: '/gitlab-org/gitlab-ee/-/jobs/62411333/artifacts/browse', + path: '/gitlab-org/gitlab/-/jobs/62411333/artifacts/download', + keep_path: '/gitlab-org/gitlab/-/jobs/62411333/artifacts/keep', + browse_path: '/gitlab-org/gitlab/-/jobs/62411333/artifacts/browse', }, ], manual_actions: [ { name: 'package-and-qa', - path: '/gitlab-org/gitlab-ee/-/jobs/62411330/play', + path: '/gitlab-org/gitlab/-/jobs/62411330/play', playable: true, }, { name: 'review-docs-deploy', - path: '/gitlab-org/gitlab-ee/-/jobs/62411332/play', + path: '/gitlab-org/gitlab/-/jobs/62411332/play', playable: true, }, ], }, ref: { name: 'master', - path: '/gitlab-org/gitlab-ee/commits/master', + path: '/gitlab-org/gitlab/commits/master', tag: false, branch: true, }, @@ -312,10 +312,10 @@ export const pipelineWithStages = { author_gravatar_url: 'https://secure.gravatar.com/avatar/263da227929cc0035cb0eba512bcf81a?s=80\u0026d=identicon', commit_url: - 'https://gitlab.com/gitlab-org/gitlab-ee/commit/e6a2885c503825792cb8a84a8731295e361bd059', - commit_path: '/gitlab-org/gitlab-ee/commit/e6a2885c503825792cb8a84a8731295e361bd059', + 'https://gitlab.com/gitlab-org/gitlab/commit/e6a2885c503825792cb8a84a8731295e361bd059', + commit_path: '/gitlab-org/gitlab/commit/e6a2885c503825792cb8a84a8731295e361bd059', }, - cancel_path: '/gitlab-org/gitlab-ee/pipelines/20333396/cancel', + cancel_path: '/gitlab-org/gitlab/pipelines/20333396/cancel', triggered_by: null, triggered: [], }; diff --git a/spec/javascripts/releases/components/release_block_spec.js b/spec/javascripts/releases/components/release_block_spec.js new file mode 100644 index 00000000000..11a385fa64d --- /dev/null +++ b/spec/javascripts/releases/components/release_block_spec.js @@ -0,0 +1,170 @@ +import Vue from 'vue'; +import component from '~/releases/components/release_block.vue'; +import timeagoMixin from '~/vue_shared/mixins/timeago'; + +import mountComponent from '../../helpers/vue_mount_component_helper'; + +describe('Release block', () => { + const Component = Vue.extend(component); + + const release = { + name: 'Bionic Beaver', + tag_name: '18.04', + description: '## changelog\n\n* line 1\n* line2', + description_html: '<div><h2>changelog</h2><ul><li>line1</li<li>line 2</li></ul></div>', + author_name: 'Release bot', + author_email: 'release-bot@example.com', + released_at: '2012-05-28T05:00:00-07:00', + author: { + avatar_url: 'uploads/-/system/user/avatar/johndoe/avatar.png', + id: 482476, + name: 'John Doe', + path: '/johndoe', + state: 'active', + status_tooltip_html: null, + username: 'johndoe', + web_url: 'https://gitlab.com/johndoe', + }, + commit: { + id: '2695effb5807a22ff3d138d593fd856244e155e7', + short_id: '2695effb', + title: 'Initial commit', + created_at: '2017-07-26T11:08:53.000+02:00', + parent_ids: ['2a4b78934375d7f53875269ffd4f45fd83a84ebe'], + message: 'Initial commit', + author_name: 'John Smith', + author_email: 'john@example.com', + authored_date: '2012-05-28T04:42:42-07:00', + committer_name: 'Jack Smith', + committer_email: 'jack@example.com', + committed_date: '2012-05-28T04:42:42-07:00', + }, + assets: { + count: 6, + sources: [ + { + format: 'zip', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.zip', + }, + { + format: 'tar.gz', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', + }, + { + format: 'tar.bz2', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', + }, + { + format: 'tar', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', + }, + ], + links: [ + { + name: 'release-18.04.dmg', + url: 'https://my-external-hosting.example.com/scrambled-url/', + external: true, + }, + { + name: 'binary-linux-amd64', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', + external: false, + }, + ], + }, + }; + let vm; + + const factory = props => mountComponent(Component, { release: props }); + + beforeEach(() => { + vm = factory(release); + }); + + afterEach(() => { + vm.$destroy(); + }); + + it("renders the block with an id equal to the release's tag name", () => { + expect(vm.$el.id).toBe('18.04'); + }); + + it('renders release name', () => { + expect(vm.$el.textContent).toContain(release.name); + }); + + it('renders commit sha', () => { + expect(vm.$el.textContent).toContain(release.commit.short_id); + }); + + it('renders tag name', () => { + expect(vm.$el.textContent).toContain(release.tag_name); + }); + + it('renders release date', () => { + expect(vm.$el.textContent).toContain(timeagoMixin.methods.timeFormated(release.released_at)); + }); + + it('renders number of assets provided', () => { + expect(vm.$el.querySelector('.js-assets-count').textContent).toContain(release.assets.count); + }); + + it('renders dropdown with the sources', () => { + expect(vm.$el.querySelectorAll('.js-sources-dropdown li').length).toEqual( + release.assets.sources.length, + ); + + expect(vm.$el.querySelector('.js-sources-dropdown li a').getAttribute('href')).toEqual( + release.assets.sources[0].url, + ); + + expect(vm.$el.querySelector('.js-sources-dropdown li a').textContent).toContain( + release.assets.sources[0].format, + ); + }); + + it('renders list with the links provided', () => { + expect(vm.$el.querySelectorAll('.js-assets-list li').length).toEqual( + release.assets.links.length, + ); + + expect(vm.$el.querySelector('.js-assets-list li a').getAttribute('href')).toEqual( + release.assets.links[0].url, + ); + + expect(vm.$el.querySelector('.js-assets-list li a').textContent).toContain( + release.assets.links[0].name, + ); + }); + + it('renders author avatar', () => { + expect(vm.$el.querySelector('.user-avatar-link')).not.toBeNull(); + }); + + describe('external label', () => { + it('renders external label when link is external', () => { + expect(vm.$el.querySelector('.js-assets-list li a').textContent).toContain('external source'); + }); + + it('does not render external label when link is not external', () => { + expect(vm.$el.querySelector('.js-assets-list li:nth-child(2) a').textContent).not.toContain( + 'external source', + ); + }); + }); + + describe('with upcoming_release flag', () => { + beforeEach(() => { + vm = factory(Object.assign({}, release, { upcoming_release: true })); + }); + + it('renders upcoming release badge', () => { + expect(vm.$el.textContent).toContain('Upcoming Release'); + }); + }); +}); diff --git a/spec/javascripts/releases/mock_data.js b/spec/javascripts/releases/mock_data.js index 2855eca1711..7197eb7bca8 100644 --- a/spec/javascripts/releases/mock_data.js +++ b/spec/javascripts/releases/mock_data.js @@ -33,20 +33,21 @@ export const release = { sources: [ { format: 'zip', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.zip', + url: 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.zip', }, { format: 'tar.gz', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', }, { format: 'tar.bz2', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', }, { format: 'tar', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', + url: 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', }, ], links: [ @@ -58,7 +59,7 @@ export const release = { { name: 'binary-linux-amd64', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', external: false, }, ], @@ -103,23 +104,24 @@ export const releases = [ { format: 'tar.gz', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz', }, { format: 'tar.bz2', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2', }, { format: 'tar', - url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', + url: + 'https://gitlab.com/gitlab-org/gitlab-foss/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar', }, ], links: [ { name: 'binary-linux-amd64', url: - 'https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', + 'https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50', external: false, }, ], diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index ce7fa7a52ae..9702cb56d99 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -1,4 +1,4 @@ -/* eslint-disable no-var, one-var, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, object-shorthand, vars-on-top */ +/* eslint-disable no-var, one-var, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, vars-on-top */ import $ from 'jquery'; import '~/gl_dropdown'; @@ -30,9 +30,9 @@ describe('Search autocomplete dropdown', () => { dashboardMRsPath = '/dashboard/merge_requests'; - projectIssuesPath = '/gitlab-org/gitlab-ce/issues'; + projectIssuesPath = '/gitlab-org/gitlab-foss/issues'; - projectMRsPath = '/gitlab-org/gitlab-ce/merge_requests'; + projectMRsPath = '/gitlab-org/gitlab-foss/merge_requests'; groupIssuesPath = '/groups/gitlab-org/issues'; @@ -91,7 +91,7 @@ describe('Search autocomplete dropdown', () => { 'gitlab-ce': { issuesPath: projectIssuesPath, mrPath: projectMRsPath, - projectName: projectName, + projectName, }, }); }; diff --git a/spec/javascripts/vue_shared/components/commit_spec.js b/spec/javascripts/vue_shared/components/commit_spec.js index f2e20f626b5..f89627e727b 100644 --- a/spec/javascripts/vue_shared/components/commit_spec.js +++ b/spec/javascripts/vue_shared/components/commit_spec.js @@ -23,7 +23,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', shortSha: 'b7836edd', title: 'Commit message', author: { @@ -46,7 +46,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', shortSha: 'b7836edd', title: 'Commit message', author: { @@ -130,7 +130,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', shortSha: 'b7836edd', title: null, author: {}, @@ -153,7 +153,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', shortSha: 'b7836edd', title: null, author: {}, @@ -181,7 +181,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', mergeRequestRef: { iid: 1234, path: 'https://example.com/path/to/mr', @@ -214,7 +214,7 @@ describe('Commit component', () => { ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', }, commitUrl: - 'https://gitlab.com/gitlab-org/gitlab-ce/commit/b7836eddf62d663c665769e1b0960197fd215067', + 'https://gitlab.com/gitlab-org/gitlab-foss/commit/b7836eddf62d663c665769e1b0960197fd215067', mergeRequestRef: { iid: 1234, path: '/path/to/mr', diff --git a/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js b/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js index 7f5f1a778d7..f8271866ca1 100644 --- a/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js +++ b/spec/javascripts/vue_shared/components/project_selector/project_selector_spec.js @@ -2,7 +2,9 @@ import Vue from 'vue'; import _ from 'underscore'; import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue'; import ProjectListItem from '~/vue_shared/components/project_selector/project_list_item.vue'; -import { shallowMount } from '@vue/test-utils'; + +import { GlSearchBoxByType } from '@gitlab/ui'; +import { mount } from '@vue/test-utils'; import { trimText } from 'spec/helpers/text_helper'; describe('ProjectSelector component', () => { @@ -14,10 +16,12 @@ describe('ProjectSelector component', () => { let selected = []; selected = selected.concat(allProjects.slice(0, 3)).concat(allProjects.slice(5, 8)); + const findSearchInput = () => wrapper.find(GlSearchBoxByType).find('input'); + beforeEach(() => { jasmine.clock().install(); - wrapper = shallowMount(Vue.extend(ProjectSelector), { + wrapper = mount(Vue.extend(ProjectSelector), { propsData: { projectSearchResults: searchResults, selectedProjects: selected, @@ -26,6 +30,7 @@ describe('ProjectSelector component', () => { showLoadingIndicator: false, showSearchErrorMessage: false, }, + sync: false, attachToDocument: true, }); @@ -44,7 +49,8 @@ describe('ProjectSelector component', () => { it(`triggers a (debounced) search when the search input value changes`, () => { spyOn(vm, '$emit'); const query = 'my test query!'; - const searchInput = wrapper.find('.js-project-selector-input'); + const searchInput = findSearchInput(); + searchInput.setValue(query); searchInput.trigger('input'); @@ -56,7 +62,7 @@ describe('ProjectSelector component', () => { it(`debounces the search input`, () => { spyOn(vm, '$emit'); - const searchInput = wrapper.find('.js-project-selector-input'); + const searchInput = findSearchInput(); const updateSearchQuery = (count = 0) => { if (count === 10) { @@ -77,9 +83,9 @@ describe('ProjectSelector component', () => { }); it(`includes a placeholder in the search box`, () => { - expect(wrapper.find('.js-project-selector-input').attributes('placeholder')).toBe( - 'Search your projects', - ); + const searchInput = findSearchInput(); + + expect(searchInput.attributes('placeholder')).toBe('Search your projects'); }); it(`triggers a "projectClicked" event when a project is clicked`, () => { @@ -92,41 +98,35 @@ describe('ProjectSelector component', () => { it(`shows a "no results" message if showNoResultsMessage === true`, () => { wrapper.setProps({ showNoResultsMessage: true }); - expect(wrapper.contains('.js-no-results-message')).toBe(true); + return vm.$nextTick().then(() => { + const noResultsEl = wrapper.find('.js-no-results-message'); - const noResultsEl = wrapper.find('.js-no-results-message'); - - expect(trimText(noResultsEl.text())).toEqual('Sorry, no projects matched your search'); + expect(noResultsEl.exists()).toBe(true); + expect(trimText(noResultsEl.text())).toEqual('Sorry, no projects matched your search'); + }); }); it(`shows a "minimum search query" message if showMinimumSearchQueryMessage === true`, () => { wrapper.setProps({ showMinimumSearchQueryMessage: true }); - expect(wrapper.contains('.js-minimum-search-query-message')).toBe(true); - - const minimumSearchEl = wrapper.find('.js-minimum-search-query-message'); + return vm.$nextTick().then(() => { + const minimumSearchEl = wrapper.find('.js-minimum-search-query-message'); - expect(trimText(minimumSearchEl.text())).toEqual('Enter at least three characters to search'); + expect(minimumSearchEl.exists()).toBe(true); + expect(trimText(minimumSearchEl.text())).toEqual('Enter at least three characters to search'); + }); }); it(`shows a error message if showSearchErrorMessage === true`, () => { wrapper.setProps({ showSearchErrorMessage: true }); - expect(wrapper.contains('.js-search-error-message')).toBe(true); - - const errorMessageEl = wrapper.find('.js-search-error-message'); - - expect(trimText(errorMessageEl.text())).toEqual( - 'Something went wrong, unable to search projects', - ); - }); + return vm.$nextTick().then(() => { + const errorMessageEl = wrapper.find('.js-search-error-message'); - it(`focuses the input element when the focusSearchInput() method is called`, () => { - const input = wrapper.find('.js-project-selector-input'); - - expect(document.activeElement).not.toBe(input.element); - vm.focusSearchInput(); - - expect(document.activeElement).toBe(input.element); + expect(errorMessageEl.exists()).toBe(true); + expect(trimText(errorMessageEl.text())).toEqual( + 'Something went wrong, unable to search projects', + ); + }); }); }); |