Commit 2c0b1b62 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 20758bc3
import initRegistryImages from '~/registry';
import initRegistryImages from '~/registry/list';
document.addEventListener('DOMContentLoaded', initRegistryImages);
import initRegistryImages from '~/registry/index';
import initRegistryImages from '~/registry/list/index';
document.addEventListener('DOMContentLoaded', initRegistryImages);
......@@ -5,7 +5,7 @@ import store from '../stores';
import CollapsibleContainer from './collapsible_container.vue';
import ProjectEmptyState from './project_empty_state.vue';
import GroupEmptyState from './group_empty_state.vue';
import { s__, sprintf } from '../../locale';
import { s__, sprintf } from '~/locale';
export default {
name: 'RegistryListApp',
......
import { __ } from '../locale';
import { __ } from '~/locale';
export const FETCH_REGISTRY_ERROR_MESSAGE = __(
'Something went wrong while fetching the registry list.',
......
import Vue from 'vue';
import registryApp from './components/app.vue';
import Translate from '../vue_shared/translate';
import Translate from '~/vue_shared/translate';
Vue.use(Translate);
......
......@@ -34,7 +34,7 @@ You can either use the user interface (UI), or connect your local computer
with GitLab [through the command line](../../../gitlab-basics/command-line-commands.md#start-working-on-your-project).
To configure [GitLab CI/CD](../../../ci/README.md) to build, test, and deploy
you code, add a file called [`.gitlab-ci.yml`](../../../ci/quick_start/README.md)
your code, add a file called [`.gitlab-ci.yml`](../../../ci/quick_start/README.md)
to your repository's root.
**From the user interface:**
......
import Vue from 'vue';
import { trimText } from 'helpers/text_helper';
import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex';
import CompareVersionsComponent from '~/diffs/components/compare_versions.vue';
import Icon from '~/vue_shared/components/icon.vue';
import { createStore } from '~/mr_notes/stores';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import diffsMockData from '../mock_data/merge_request_diffs';
import getDiffWithCommit from '../mock_data/diff_with_commit';
const localVue = createLocalVue();
localVue.use(Vuex);
describe('CompareVersions', () => {
let vm;
let wrapper;
const targetBranch = { branchName: 'tmp-wine-dev', versionIndex: -1 };
beforeEach(() => {
const createWrapper = props => {
const store = createStore();
store.state.diffs.addedLines = 10;
store.state.diffs.removedLines = 20;
store.state.diffs.diffFiles.push('test');
vm = createComponentWithStore(Vue.extend(CompareVersionsComponent), store, {
wrapper = mount(CompareVersionsComponent, {
sync: false,
attachToDocument: true,
localVue,
store,
propsData: {
mergeRequestDiffs: diffsMockData,
mergeRequestDiff: diffsMockData[0],
targetBranch,
}).$mount();
...props,
},
});
};
beforeEach(() => {
createWrapper();
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('template', () => {
it('should render Tree List toggle button with correct attribute values', () => {
const treeListBtn = vm.$el.querySelector('.js-toggle-tree-list');
const treeListBtn = wrapper.find('.js-toggle-tree-list');
expect(treeListBtn).not.toBeNull();
expect(treeListBtn.dataset.originalTitle).toBe('Hide file browser');
expect(treeListBtn.querySelectorAll('svg use').length).not.toBe(0);
expect(treeListBtn.querySelector('svg use').getAttribute('xlink:href')).toContain(
'#collapse-left',
);
expect(treeListBtn.exists()).toBe(true);
expect(treeListBtn.attributes('data-original-title')).toBe('Hide file browser');
expect(treeListBtn.findAll(Icon).length).not.toBe(0);
expect(treeListBtn.find(Icon).props('name')).toBe('collapse-left');
});
it('should render comparison dropdowns with correct values', () => {
const sourceDropdown = vm.$el.querySelector('.mr-version-dropdown');
const targetDropdown = vm.$el.querySelector('.mr-version-compare-dropdown');
const sourceDropdown = wrapper.find('.mr-version-dropdown');
const targetDropdown = wrapper.find('.mr-version-compare-dropdown');
expect(sourceDropdown).not.toBeNull();
expect(targetDropdown).not.toBeNull();
expect(sourceDropdown.querySelector('a span').innerHTML).toContain('latest version');
expect(targetDropdown.querySelector('a span').innerHTML).toContain(targetBranch.branchName);
expect(sourceDropdown.exists()).toBe(true);
expect(targetDropdown.exists()).toBe(true);
expect(sourceDropdown.find('a span').html()).toContain('latest version');
expect(targetDropdown.find('a span').html()).toContain(targetBranch.branchName);
});
it('should not render comparison dropdowns if no mergeRequestDiffs are specified', () => {
vm.mergeRequestDiffs = [];
createWrapper({ mergeRequestDiffs: [] });
vm.$nextTick(() => {
const sourceDropdown = vm.$el.querySelector('.mr-version-dropdown');
const targetDropdown = vm.$el.querySelector('.mr-version-compare-dropdown');
const sourceDropdown = wrapper.find('.mr-version-dropdown');
const targetDropdown = wrapper.find('.mr-version-compare-dropdown');
expect(sourceDropdown).toBeNull();
expect(targetDropdown).toBeNull();
});
expect(sourceDropdown.exists()).toBe(false);
expect(targetDropdown.exists()).toBe(false);
});
it('should render view types buttons with correct values', () => {
const inlineBtn = vm.$el.querySelector('#inline-diff-btn');
const parallelBtn = vm.$el.querySelector('#parallel-diff-btn');
const inlineBtn = wrapper.find('#inline-diff-btn');
const parallelBtn = wrapper.find('#parallel-diff-btn');
expect(inlineBtn).not.toBeNull();
expect(parallelBtn).not.toBeNull();
expect(inlineBtn.dataset.viewType).toEqual('inline');
expect(parallelBtn.dataset.viewType).toEqual('parallel');
expect(inlineBtn.innerHTML).toContain('Inline');
expect(parallelBtn.innerHTML).toContain('Side-by-side');
expect(inlineBtn.exists()).toBe(true);
expect(parallelBtn.exists()).toBe(true);
expect(inlineBtn.attributes('data-view-type')).toEqual('inline');
expect(parallelBtn.attributes('data-view-type')).toEqual('parallel');
expect(inlineBtn.html()).toContain('Inline');
expect(parallelBtn.html()).toContain('Side-by-side');
});
it('adds container-limiting classes when showFileTree is false with inline diffs', () => {
vm.isLimitedContainer = true;
createWrapper({ isLimitedContainer: true });
vm.$nextTick(() => {
const limitedContainer = vm.$el.querySelector('.container-limited.limit-container-width');
const limitedContainer = wrapper.find('.container-limited.limit-container-width');
expect(limitedContainer).not.toBeNull();
});
expect(limitedContainer.exists()).toBe(true);
});
it('does not add container-limiting classes when showFileTree is false with inline diffs', () => {
vm.isLimitedContainer = false;
createWrapper({ isLimitedContainer: false });
vm.$nextTick(() => {
const limitedContainer = vm.$el.querySelector('.container-limited.limit-container-width');
const limitedContainer = wrapper.find('.container-limited.limit-container-width');
expect(limitedContainer).toBeNull();
});
expect(limitedContainer.exists()).toBe(false);
});
});
describe('setInlineDiffViewType', () => {
it('should persist the view type in the url', () => {
const viewTypeBtn = vm.$el.querySelector('#inline-diff-btn');
viewTypeBtn.click();
const viewTypeBtn = wrapper.find('#inline-diff-btn');
viewTypeBtn.trigger('click');
expect(window.location.toString()).toContain('?view=inline');
});
......@@ -101,8 +114,8 @@ describe('CompareVersions', () => {
describe('setParallelDiffViewType', () => {
it('should persist the view type in the url', () => {
const viewTypeBtn = vm.$el.querySelector('#parallel-diff-btn');
viewTypeBtn.click();
const viewTypeBtn = wrapper.find('#parallel-diff-btn');
viewTypeBtn.trigger('click');
expect(window.location.toString()).toContain('?view=parallel');
});
......@@ -110,7 +123,7 @@ describe('CompareVersions', () => {
describe('comparableDiffs', () => {
it('should not contain the first item in the mergeRequestDiffs property', () => {
const { comparableDiffs } = vm;
const { comparableDiffs } = wrapper.vm;
const comparableDiffsMock = diffsMockData.slice(1);
expect(comparableDiffs).toEqual(comparableDiffsMock);
......@@ -119,27 +132,25 @@ describe('CompareVersions', () => {
describe('baseVersionPath', () => {
it('should be set correctly from mergeRequestDiff', () => {
expect(vm.baseVersionPath).toEqual(vm.mergeRequestDiff.base_version_path);
expect(wrapper.vm.baseVersionPath).toEqual(wrapper.vm.mergeRequestDiff.base_version_path);
});
});
describe('commit', () => {
beforeEach(done => {
vm.$store.state.diffs.commit = getDiffWithCommit().commit;
vm.mergeRequestDiffs = [];
wrapper.vm.$store.state.diffs.commit = getDiffWithCommit().commit;
wrapper.mergeRequestDiffs = [];
vm.$nextTick(done);
wrapper.vm.$nextTick(done);
});
it('renders latest version button', () => {
expect(vm.$el.querySelector('.js-latest-version').textContent.trim()).toBe(
'Show latest version',
);
expect(trimText(wrapper.find('.js-latest-version').text())).toBe('Show latest version');
});
it('renders short commit ID', () => {
expect(vm.$el.textContent).toContain('Viewing commit');
expect(vm.$el.textContent).toContain(vm.commit.short_id);
expect(wrapper.text()).toContain('Viewing commit');
expect(wrapper.text()).toContain(wrapper.vm.commit.short_id);
});
});
});
const FIXTURE = 'merge_request_diffs/with_commit.json';
preloadFixtures(FIXTURE);
export default function getDiffWithCommit() {
return getJSONFixture(FIXTURE);
}
export default [
{
base_version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=37',
version_index: 4,
created_at: '2018-10-23T11:49:16.611Z',
commits_count: 4,
latest: true,
short_commit_sha: 'de7a8f7f',
version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=37',
compare_path:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=de7a8f7f20c3ea2e0bef3ba01cfd41c21f6b4995',
},
{
base_version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=36',
version_index: 3,
created_at: '2018-10-23T11:46:40.617Z',
commits_count: 3,
latest: false,
short_commit_sha: 'e78fc18f',
version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=36',
compare_path:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=e78fc18fa37acb2185c59ca94d4a964464feb50e',
},
{
base_version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=35',
version_index: 2,
created_at: '2018-10-04T09:57:39.648Z',
commits_count: 2,
latest: false,
short_commit_sha: '48da7e7e',
version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=35',
compare_path:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=48da7e7e9a99d41c852578bd9cb541ca4d864b3e',
},
{
base_version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=20',
version_index: 1,
created_at: '2018-09-25T20:30:39.493Z',
commits_count: 1,
latest: false,
short_commit_sha: '47bac2ed',
version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=20',
compare_path:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=47bac2ed972c5bee344c1cea159a22cd7f711dc0',
},
];
import Vue from 'vue';
import { mount } from '@vue/test-utils';
import registry from '~/registry/components/app.vue';
import { TEST_HOST } from '../../helpers/test_constants';
import registry from '~/registry/list/components/app.vue';
import { TEST_HOST } from 'helpers/test_constants';
import { reposServerResponse, parsedReposServerResponse } from '../mock_data';
describe('Registry List', () => {
......
......@@ -3,8 +3,8 @@ import Vuex from 'vuex';
import { mount, createLocalVue } from '@vue/test-utils';
import createFlash from '~/flash';
import Tracking from '~/tracking';
import collapsibleComponent from '~/registry/components/collapsible_container.vue';
import * as getters from '~/registry/stores/getters';
import collapsibleComponent from '~/registry/list/components/collapsible_container.vue';
import * as getters from '~/registry/list/stores/getters';
import { repoPropsData } from '../mock_data';
jest.mock('~/flash.js');
......
import { mount } from '@vue/test-utils';
import groupEmptyState from '~/registry/components/group_empty_state.vue';
import groupEmptyState from '~/registry/list/components/group_empty_state.vue';
describe('Registry Group Empty state', () => {
let wrapper;
......
import { mount } from '@vue/test-utils';
import projectEmptyState from '~/registry/components/project_empty_state.vue';
import projectEmptyState from '~/registry/list/components/project_empty_state.vue';
describe('Registry Project Empty state', () => {
let wrapper;
......
......@@ -3,9 +3,9 @@ import Vuex from 'vuex';
import { mount, createLocalVue } from '@vue/test-utils';
import createFlash from '~/flash';
import Tracking from '~/tracking';
import tableRegistry from '~/registry/components/table_registry.vue';
import tableRegistry from '~/registry/list/components/table_registry.vue';
import { repoPropsData } from '../mock_data';
import * as getters from '~/registry/stores/getters';
import * as getters from '~/registry/list/stores/getters';
jest.mock('~/flash');
......
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
import * as actions from '~/registry/stores/actions';
import * as types from '~/registry/stores/mutation_types';
import { TEST_HOST } from '../../helpers/test_constants';
import testAction from '../../helpers/vuex_action_helper';
import * as actions from '~/registry/list/stores/actions';
import * as types from '~/registry/list/stores/mutation_types';
import { TEST_HOST } from 'helpers/test_constants';
import testAction from 'helpers/vuex_action_helper';
import createFlash from '~/flash';
import {
......
import * as getters from '~/registry/stores/getters';
import * as getters from '~/registry/list/stores/getters';
describe('Getters Registry Store', () => {
let state;
......
import mutations from '~/registry/stores/mutations';
import * as types from '~/registry/stores/mutation_types';
import mutations from '~/registry/list/stores/mutations';
import * as types from '~/registry/list/stores/mutation_types';
import {
defaultState,
reposServerResponse,
......
const FIXTURE = 'merge_request_diffs/with_commit.json';
// 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-foss/merge_requests/31349
preloadFixtures(FIXTURE);
import getDiffWithCommit from '../../../frontend/diffs/mock_data/diff_with_commit';
export default function getDiffWithCommit() {
return getJSONFixture(FIXTURE);
}
export default getDiffWithCommit;
export default [
{
base_version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=37',
version_index: 4,
created_at: '2018-10-23T11:49:16.611Z',
commits_count: 4,
latest: true,
short_commit_sha: 'de7a8f7f',
version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=37',
compare_path:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=de7a8f7f20c3ea2e0bef3ba01cfd41c21f6b4995',
},
{
base_version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=36',
version_index: 3,
created_at: '2018-10-23T11:46:40.617Z',
commits_count: 3,
latest: false,
short_commit_sha: 'e78fc18f',
version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=36',
compare_path:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=e78fc18fa37acb2185c59ca94d4a964464feb50e',
},
{
base_version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=35',
version_index: 2,
created_at: '2018-10-04T09:57:39.648Z',
commits_count: 2,
latest: false,
short_commit_sha: '48da7e7e',
version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=35',
compare_path:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=48da7e7e9a99d41c852578bd9cb541ca4d864b3e',
},
{
base_version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=20',
version_index: 1,
created_at: '2018-09-25T20:30:39.493Z',
commits_count: 1,
latest: false,
short_commit_sha: '47bac2ed',
version_path: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=20',
compare_path:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=47bac2ed972c5bee344c1cea159a22cd7f711dc0',
},
];
// 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-foss/merge_requests/31349
import diffsMockData from '../../../frontend/diffs/mock_data/merge_request_diffs';
export default diffsMockData;
......@@ -722,10 +722,10 @@
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.82.0.tgz#c059c460afc13ebfe9df370521ca8963fa5afb80"
integrity sha512-9L4Brys2LCk44lHvFsCFDKN768lYjoMVYDb4PD7FSjqUEruQQ1SRj0rvb1RWKLhiTCDKrtDOXkH6I1TTEms24w==
"@gitlab/ui@7.16.1":
version "7.16.1"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-7.16.1.tgz#a539bd2e39866549f71d8678efe7cca8478ebde3"
integrity sha512-7SdwSC2P2/PKZNaIzNihAudSpP95cex98i6IMcukK0ocJYvHr8S9s8GoznaD8YugTR1EGhu+f1M6ubneU5vUwQ==
"@gitlab/ui@8.0.1":
version "8.0.1"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-8.0.1.tgz#4e3b4791045540785cc389af931e24c6411910ca"
integrity sha512-PfZPlx3f12wcGxe0eMAXRk1gdhEAkX4czQWAt8EQ1WosKiADCNzCpEPR4jyWa60RF/+zHqJKIjq0VqLMClk8Jg==
dependencies:
"@babel/standalone" "^7.0.0"
"@gitlab/vue-toasted" "^1.3.0"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment