Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
900c5cc840
commit
c13bf68077
13 changed files with 338 additions and 179 deletions
|
@ -1,21 +1,19 @@
|
|||
<script>
|
||||
import { GlButton } from '@gitlab/ui';
|
||||
import { mapActions, mapGetters, mapState } from 'vuex';
|
||||
import { getMilestone } from 'ee_else_ce/boards/boards_util';
|
||||
import BoardNewIssueMixin from 'ee_else_ce/boards/mixins/board_new_issue';
|
||||
import { __ } from '~/locale';
|
||||
|
||||
import { toggleFormEventPrefix } from '../constants';
|
||||
import eventHub from '../eventhub';
|
||||
|
||||
import BoardNewItem from './board_new_item.vue';
|
||||
import ProjectSelect from './project_select.vue';
|
||||
|
||||
export default {
|
||||
name: 'BoardNewIssue',
|
||||
i18n: {
|
||||
cancel: __('Cancel'),
|
||||
},
|
||||
components: {
|
||||
BoardNewItem,
|
||||
ProjectSelect,
|
||||
GlButton,
|
||||
},
|
||||
mixins: [BoardNewIssueMixin],
|
||||
inject: ['groupId'],
|
||||
|
@ -25,106 +23,55 @@ export default {
|
|||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(['selectedProject']),
|
||||
...mapGetters(['isGroupBoard', 'isEpicBoard']),
|
||||
/**
|
||||
* We've extended this component in EE where
|
||||
* submitButtonTitle returns a different string
|
||||
* hence this is kept as a computed prop.
|
||||
*/
|
||||
submitButtonTitle() {
|
||||
return __('Create issue');
|
||||
...mapState(['selectedProject', 'fullPath']),
|
||||
...mapGetters(['isGroupBoard']),
|
||||
formEventPrefix() {
|
||||
return toggleFormEventPrefix.issue;
|
||||
},
|
||||
disabled() {
|
||||
if (this.isGroupBoard) {
|
||||
return this.title === '' || !this.selectedProject.name;
|
||||
}
|
||||
return this.title === '';
|
||||
disableSubmit() {
|
||||
return this.isGroupBoard ? !this.selectedProject.name : false;
|
||||
},
|
||||
inputFieldId() {
|
||||
// eslint-disable-next-line @gitlab/require-i18n-strings
|
||||
return `${this.list.id}-title`;
|
||||
projectPath() {
|
||||
return this.isGroupBoard ? this.selectedProject.fullPath : this.fullPath;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$refs.input.focus();
|
||||
eventHub.$on('setSelectedProject', this.setSelectedProject);
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['addListNewIssue']),
|
||||
submit() {
|
||||
const { title } = this;
|
||||
submit({ title }) {
|
||||
const labels = this.list.label ? [this.list.label] : [];
|
||||
const assignees = this.list.assignee ? [this.list.assignee] : [];
|
||||
const milestone = getMilestone(this.list);
|
||||
|
||||
eventHub.$emit(`scroll-board-list-${this.list.id}`);
|
||||
|
||||
return this.addListNewIssue({
|
||||
list: this.list,
|
||||
issueInput: {
|
||||
title,
|
||||
labelIds: labels?.map((l) => l.id),
|
||||
assigneeIds: assignees?.map((a) => a?.id),
|
||||
milestoneId: milestone?.id,
|
||||
projectPath: this.selectedProject.fullPath,
|
||||
...this.extraIssueInput(),
|
||||
projectPath: this.projectPath,
|
||||
},
|
||||
list: this.list,
|
||||
}).then(() => {
|
||||
this.reset();
|
||||
this.cancel();
|
||||
});
|
||||
},
|
||||
reset() {
|
||||
this.title = '';
|
||||
eventHub.$emit(`${toggleFormEventPrefix.issue}${this.list.id}`);
|
||||
cancel() {
|
||||
eventHub.$emit(`${this.formEventPrefix}${this.list.id}`);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="board-new-issue-form">
|
||||
<div class="board-card position-relative p-3 rounded">
|
||||
<form ref="submitForm" @submit.prevent="submit">
|
||||
<label :for="inputFieldId" class="label-bold">{{ __('Title') }}</label>
|
||||
<input
|
||||
:id="inputFieldId"
|
||||
ref="input"
|
||||
v-model="title"
|
||||
class="form-control"
|
||||
type="text"
|
||||
name="issue_title"
|
||||
autocomplete="off"
|
||||
/>
|
||||
<project-select v-if="isGroupBoard && !isEpicBoard" :group-id="groupId" :list="list" />
|
||||
<div class="clearfix gl-mt-3">
|
||||
<gl-button
|
||||
ref="submitButton"
|
||||
:disabled="disabled"
|
||||
class="float-left js-no-auto-disable"
|
||||
variant="confirm"
|
||||
category="primary"
|
||||
type="submit"
|
||||
<board-new-item
|
||||
:list="list"
|
||||
:form-event-prefix="formEventPrefix"
|
||||
:submit-button-title="__('Create issue')"
|
||||
:disable-submit="disableSubmit"
|
||||
@form-submit="submit"
|
||||
@form-cancel="cancel"
|
||||
>
|
||||
{{ submitButtonTitle }}
|
||||
</gl-button>
|
||||
<gl-button
|
||||
ref="cancelButton"
|
||||
class="float-right"
|
||||
type="button"
|
||||
variant="default"
|
||||
@click="reset"
|
||||
>
|
||||
{{ $options.i18n.cancel }}
|
||||
</gl-button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<project-select v-if="isGroupBoard" :group-id="groupId" :list="list" />
|
||||
</board-new-item>
|
||||
</template>
|
||||
|
|
|
@ -11,7 +11,7 @@ import ProjectSelect from './project_select_deprecated.vue';
|
|||
// This component is being replaced in favor of './board_new_issue.vue' for GraphQL boards
|
||||
|
||||
export default {
|
||||
name: 'BoardNewIssue',
|
||||
name: 'BoardNewIssueDeprecated',
|
||||
components: {
|
||||
ProjectSelect,
|
||||
GlButton,
|
||||
|
|
95
app/assets/javascripts/boards/components/board_new_item.vue
Normal file
95
app/assets/javascripts/boards/components/board_new_item.vue
Normal file
|
@ -0,0 +1,95 @@
|
|||
<script>
|
||||
import { GlForm, GlFormInput, GlButton } from '@gitlab/ui';
|
||||
import { __ } from '~/locale';
|
||||
|
||||
import eventHub from '../eventhub';
|
||||
|
||||
export default {
|
||||
i18n: {
|
||||
cancel: __('Cancel'),
|
||||
},
|
||||
components: {
|
||||
GlForm,
|
||||
GlFormInput,
|
||||
GlButton,
|
||||
},
|
||||
props: {
|
||||
list: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
formEventPrefix: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
disableSubmit: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
submitButtonTitle: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: __('Create issue'),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
inputFieldId() {
|
||||
// eslint-disable-next-line @gitlab/require-i18n-strings
|
||||
return `${this.list.id}-title`;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleFormCancel() {
|
||||
this.title = '';
|
||||
this.$emit('form-cancel');
|
||||
},
|
||||
handleFormSubmit() {
|
||||
const { title, list } = this;
|
||||
|
||||
eventHub.$emit(`scroll-board-list-${this.list.id}`);
|
||||
this.$emit('form-submit', {
|
||||
title,
|
||||
list,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="board-new-issue-form">
|
||||
<div class="board-card position-relative gl-p-5 rounded">
|
||||
<gl-form @submit.prevent="handleFormSubmit" @reset="handleFormCancel">
|
||||
<label :for="inputFieldId" class="gl-font-weight-bold">{{ __('Title') }}</label>
|
||||
<gl-form-input
|
||||
:id="inputFieldId"
|
||||
v-model.trim="title"
|
||||
:autofocus="true"
|
||||
autocomplete="off"
|
||||
type="text"
|
||||
name="issue_title"
|
||||
/>
|
||||
<slot></slot>
|
||||
<div class="gl-clearfix gl-mt-4">
|
||||
<gl-button
|
||||
:disabled="!title || disableSubmit"
|
||||
class="gl-float-left js-no-auto-disable"
|
||||
variant="confirm"
|
||||
type="submit"
|
||||
>
|
||||
{{ submitButtonTitle }}
|
||||
</gl-button>
|
||||
<gl-button class="gl-float-right js-no-auto-disable" type="reset">
|
||||
{{ $options.i18n.cancel }}
|
||||
</gl-button>
|
||||
</div>
|
||||
</gl-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
|
@ -25,18 +25,21 @@ module Backup
|
|||
args += ['-parallel', @parallel.to_s] if type == :create && @parallel
|
||||
args += ['-parallel-storage', @parallel_storage.to_s] if type == :create && @parallel_storage
|
||||
|
||||
@read_io, @write_io = IO.pipe
|
||||
@pid = Process.spawn(bin_path, command, '-path', backup_repos_path, *args, in: @read_io, out: @progress)
|
||||
@stdin, stdout, @thread = Open3.popen2(ENV, bin_path, command, '-path', backup_repos_path, *args)
|
||||
|
||||
@out_reader = Thread.new do
|
||||
IO.copy_stream(stdout, @progress)
|
||||
end
|
||||
end
|
||||
|
||||
def wait
|
||||
return unless started?
|
||||
|
||||
@write_io.close
|
||||
Process.wait(@pid)
|
||||
status = $?
|
||||
@stdin.close
|
||||
[@thread, @out_reader].each(&:join)
|
||||
status = @thread.value
|
||||
|
||||
@pid = nil
|
||||
@thread = nil
|
||||
|
||||
raise Error, "gitaly-backup exit status #{status.exitstatus}" if status.exitstatus != 0
|
||||
end
|
||||
|
@ -46,7 +49,7 @@ module Backup
|
|||
|
||||
repository = repo_type.repository_for(container)
|
||||
|
||||
@write_io.puts({
|
||||
@stdin.puts({
|
||||
storage_name: repository.storage,
|
||||
relative_path: repository.relative_path,
|
||||
gl_project_path: repository.gl_project_path,
|
||||
|
@ -61,7 +64,7 @@ module Backup
|
|||
private
|
||||
|
||||
def started?
|
||||
@pid.present?
|
||||
@thread.present?
|
||||
end
|
||||
|
||||
def backup_repos_path
|
||||
|
|
|
@ -105,7 +105,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def commit_attrs
|
||||
@commit_attrs ||= { branch_name: 'master', message: 'Initial commit' }
|
||||
@commit_attrs ||= { branch_name: 'main', message: 'Initial commit' }
|
||||
end
|
||||
|
||||
def create_commit(snippet)
|
||||
|
|
|
@ -5384,9 +5384,6 @@ msgstr ""
|
|||
msgid "Board|Enter board name"
|
||||
msgstr ""
|
||||
|
||||
msgid "Board|Failed to create epic. Please try again."
|
||||
msgstr ""
|
||||
|
||||
msgid "Board|Failed to delete board. Please try again."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Package', :registry, :orchestrated do
|
||||
RSpec.describe 'Package', :registry, :orchestrated, only: { pipeline: :main } do
|
||||
describe 'Self-managed Container Registry' do
|
||||
let(:project) do
|
||||
Resource::Project.fabricate_via_api! do |project|
|
||||
|
|
|
@ -4,8 +4,9 @@ import Vuex from 'vuex';
|
|||
import BoardCard from '~/boards/components/board_card.vue';
|
||||
import BoardList from '~/boards/components/board_list.vue';
|
||||
import BoardNewIssue from '~/boards/components/board_new_issue.vue';
|
||||
import BoardNewItem from '~/boards/components/board_new_item.vue';
|
||||
import defaultState from '~/boards/stores/state';
|
||||
import { mockList, mockIssuesByListId, issues } from './mock_data';
|
||||
import { mockList, mockIssuesByListId, issues, mockGroupProjects } from './mock_data';
|
||||
|
||||
export default function createComponent({
|
||||
listIssueProps = {},
|
||||
|
@ -17,6 +18,7 @@ export default function createComponent({
|
|||
state = defaultState,
|
||||
stubs = {
|
||||
BoardNewIssue,
|
||||
BoardNewItem,
|
||||
BoardCard,
|
||||
},
|
||||
} = {}) {
|
||||
|
@ -25,6 +27,7 @@ export default function createComponent({
|
|||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
selectedProject: mockGroupProjects[0],
|
||||
boardItemsByListId: mockIssuesByListId,
|
||||
boardItems: issues,
|
||||
pageInfoByListId: {
|
||||
|
@ -77,6 +80,7 @@ export default function createComponent({
|
|||
provide: {
|
||||
groupId: null,
|
||||
rootPath: '/',
|
||||
boardId: '1',
|
||||
weightFeatureAvailable: false,
|
||||
boardWeight: null,
|
||||
canAdminList: true,
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
||||
import Vuex from 'vuex';
|
||||
import BoardNewIssue from '~/boards/components/board_new_issue.vue';
|
||||
import BoardNewItem from '~/boards/components/board_new_item.vue';
|
||||
import ProjectSelect from '~/boards/components/project_select.vue';
|
||||
import eventHub from '~/boards/eventhub';
|
||||
|
||||
import { mockList, mockGroupProjects } from '../mock_data';
|
||||
|
||||
|
@ -8,107 +11,104 @@ const localVue = createLocalVue();
|
|||
|
||||
localVue.use(Vuex);
|
||||
|
||||
describe('Issue boards new issue form', () => {
|
||||
let wrapper;
|
||||
let vm;
|
||||
const addListNewIssuesSpy = jest.fn().mockResolvedValue();
|
||||
const mockActions = { addListNewIssue: addListNewIssuesSpy };
|
||||
|
||||
const addListNewIssuesSpy = jest.fn();
|
||||
|
||||
const findSubmitButton = () => wrapper.find({ ref: 'submitButton' });
|
||||
const findCancelButton = () => wrapper.find({ ref: 'cancelButton' });
|
||||
const findSubmitForm = () => wrapper.find({ ref: 'submitForm' });
|
||||
|
||||
const submitIssue = () => {
|
||||
const dummySubmitEvent = {
|
||||
preventDefault() {},
|
||||
};
|
||||
|
||||
return findSubmitForm().trigger('submit', dummySubmitEvent);
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
const store = new Vuex.Store({
|
||||
state: { selectedProject: mockGroupProjects[0] },
|
||||
actions: { addListNewIssue: addListNewIssuesSpy },
|
||||
getters: { isGroupBoard: () => false, isProjectBoard: () => true },
|
||||
});
|
||||
|
||||
wrapper = shallowMount(BoardNewIssue, {
|
||||
const createComponent = ({
|
||||
state = { selectedProject: mockGroupProjects[0], fullPath: mockGroupProjects[0].fullPath },
|
||||
actions = mockActions,
|
||||
getters = { isGroupBoard: () => true, isProjectBoard: () => false },
|
||||
} = {}) =>
|
||||
shallowMount(BoardNewIssue, {
|
||||
localVue,
|
||||
store: new Vuex.Store({
|
||||
state,
|
||||
actions,
|
||||
getters,
|
||||
}),
|
||||
propsData: {
|
||||
disabled: false,
|
||||
list: mockList,
|
||||
},
|
||||
store,
|
||||
localVue,
|
||||
provide: {
|
||||
groupId: null,
|
||||
groupId: 1,
|
||||
weightFeatureAvailable: false,
|
||||
boardWeight: null,
|
||||
},
|
||||
stubs: {
|
||||
BoardNewItem,
|
||||
},
|
||||
});
|
||||
|
||||
vm = wrapper.vm;
|
||||
describe('Issue boards new issue form', () => {
|
||||
let wrapper;
|
||||
|
||||
return vm.$nextTick();
|
||||
const findBoardNewItem = () => wrapper.findComponent(BoardNewItem);
|
||||
|
||||
beforeEach(async () => {
|
||||
wrapper = createComponent();
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('calls submit if submit button is clicked', async () => {
|
||||
jest.spyOn(wrapper.vm, 'submit').mockImplementation();
|
||||
wrapper.setData({ title: 'Testing Title' });
|
||||
|
||||
await vm.$nextTick();
|
||||
await submitIssue();
|
||||
expect(wrapper.vm.submit).toHaveBeenCalled();
|
||||
it('renders board-new-item component', () => {
|
||||
const boardNewItem = findBoardNewItem();
|
||||
expect(boardNewItem.exists()).toBe(true);
|
||||
expect(boardNewItem.props()).toEqual({
|
||||
list: mockList,
|
||||
formEventPrefix: 'toggle-issue-form-',
|
||||
submitButtonTitle: 'Create issue',
|
||||
disableSubmit: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('disables submit button if title is empty', () => {
|
||||
expect(findSubmitButton().props().disabled).toBe(true);
|
||||
it('calls addListNewIssue action when `board-new-item` emits form-submit event', async () => {
|
||||
findBoardNewItem().vm.$emit('form-submit', { title: 'Foo' });
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(addListNewIssuesSpy).toHaveBeenCalledWith(expect.any(Object), {
|
||||
list: mockList,
|
||||
issueInput: {
|
||||
title: 'Foo',
|
||||
labelIds: [],
|
||||
assigneeIds: [],
|
||||
milestoneId: undefined,
|
||||
projectPath: mockGroupProjects[0].fullPath,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('enables submit button if title is not empty', async () => {
|
||||
wrapper.setData({ title: 'Testing Title' });
|
||||
it('emits event `toggle-issue-form` with current list Id suffix on eventHub when `board-new-item` emits form-cancel event', async () => {
|
||||
jest.spyOn(eventHub, '$emit').mockImplementation();
|
||||
findBoardNewItem().vm.$emit('form-cancel');
|
||||
|
||||
await vm.$nextTick();
|
||||
expect(wrapper.find({ ref: 'input' }).element.value).toBe('Testing Title');
|
||||
expect(findSubmitButton().props().disabled).toBe(false);
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(eventHub.$emit).toHaveBeenCalledWith(`toggle-issue-form-${mockList.id}`);
|
||||
});
|
||||
|
||||
it('clears title after clicking cancel', async () => {
|
||||
findCancelButton().trigger('click');
|
||||
describe('when in group issue board', () => {
|
||||
it('renders project-select component within board-new-item component', () => {
|
||||
const projectSelect = findBoardNewItem().findComponent(ProjectSelect);
|
||||
|
||||
await vm.$nextTick();
|
||||
expect(vm.title).toBe('');
|
||||
expect(projectSelect.exists()).toBe(true);
|
||||
expect(projectSelect.props('list')).toEqual(mockList);
|
||||
});
|
||||
});
|
||||
|
||||
describe('submit success', () => {
|
||||
it('creates new issue', async () => {
|
||||
wrapper.setData({ title: 'create issue' });
|
||||
|
||||
await vm.$nextTick();
|
||||
await submitIssue();
|
||||
expect(addListNewIssuesSpy).toHaveBeenCalled();
|
||||
describe('when in project issue board', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = createComponent({
|
||||
getters: { isGroupBoard: () => false, isProjectBoard: () => true },
|
||||
});
|
||||
});
|
||||
|
||||
it('enables button after submit', async () => {
|
||||
jest.spyOn(wrapper.vm, 'submit').mockImplementation();
|
||||
wrapper.setData({ title: 'create issue' });
|
||||
it('does not render project-select component within board-new-item component', () => {
|
||||
const projectSelect = findBoardNewItem().findComponent(ProjectSelect);
|
||||
|
||||
await vm.$nextTick();
|
||||
await submitIssue();
|
||||
expect(findSubmitButton().props().disabled).toBe(false);
|
||||
});
|
||||
|
||||
it('clears title after submit', async () => {
|
||||
wrapper.setData({ title: 'create issue' });
|
||||
|
||||
await vm.$nextTick();
|
||||
await submitIssue();
|
||||
await vm.$nextTick();
|
||||
expect(vm.title).toBe('');
|
||||
expect(projectSelect.exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
103
spec/frontend/boards/components/board_new_item_spec.js
Normal file
103
spec/frontend/boards/components/board_new_item_spec.js
Normal file
|
@ -0,0 +1,103 @@
|
|||
import { GlForm, GlFormInput, GlButton } from '@gitlab/ui';
|
||||
import { mountExtended } from 'helpers/vue_test_utils_helper';
|
||||
|
||||
import BoardNewItem from '~/boards/components/board_new_item.vue';
|
||||
import eventHub from '~/boards/eventhub';
|
||||
|
||||
import { mockList } from '../mock_data';
|
||||
|
||||
const createComponent = ({
|
||||
list = mockList,
|
||||
formEventPrefix = 'toggle-issue-form-',
|
||||
disabledSubmit = false,
|
||||
submitButtonTitle = 'Create item',
|
||||
} = {}) =>
|
||||
mountExtended(BoardNewItem, {
|
||||
propsData: {
|
||||
list,
|
||||
formEventPrefix,
|
||||
disabledSubmit,
|
||||
submitButtonTitle,
|
||||
},
|
||||
slots: {
|
||||
default: '<div id="default-slot"></div>',
|
||||
},
|
||||
stubs: {
|
||||
GlForm,
|
||||
},
|
||||
});
|
||||
|
||||
describe('BoardNewItem', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = createComponent();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
describe('template', () => {
|
||||
it('renders gl-form component', () => {
|
||||
expect(wrapper.findComponent(GlForm).exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('renders field label', () => {
|
||||
expect(wrapper.find('label').exists()).toBe(true);
|
||||
expect(wrapper.find('label').text()).toBe('Title');
|
||||
});
|
||||
|
||||
it('renders gl-form-input field', () => {
|
||||
expect(wrapper.findComponent(GlFormInput).exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('renders default slot contents', () => {
|
||||
expect(wrapper.find('#default-slot').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('renders submit and cancel buttons', () => {
|
||||
const buttons = wrapper.findAllComponents(GlButton);
|
||||
expect(buttons).toHaveLength(2);
|
||||
expect(buttons.at(0).text()).toBe('Create item');
|
||||
expect(buttons.at(1).text()).toBe('Cancel');
|
||||
});
|
||||
|
||||
describe('events', () => {
|
||||
const glForm = () => wrapper.findComponent(GlForm);
|
||||
const titleInput = () => wrapper.find('input[name="issue_title"]');
|
||||
|
||||
it('emits `form-submit` event with title value when `submit` is triggered on gl-form', async () => {
|
||||
titleInput().setValue('Foo');
|
||||
await glForm().trigger('submit');
|
||||
|
||||
expect(wrapper.emitted('form-submit')).toBeTruthy();
|
||||
expect(wrapper.emitted('form-submit')[0]).toEqual([
|
||||
{
|
||||
title: 'Foo',
|
||||
list: mockList,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('emits `scroll-board-list-` event with list.id on eventHub when `submit` is triggered on gl-form', async () => {
|
||||
jest.spyOn(eventHub, '$emit').mockImplementation();
|
||||
await glForm().trigger('submit');
|
||||
|
||||
expect(eventHub.$emit).toHaveBeenCalledWith(`scroll-board-list-${mockList.id}`);
|
||||
});
|
||||
|
||||
it('emits `form-cancel` event and clears title value when `reset` is triggered on gl-form', async () => {
|
||||
titleInput().setValue('Foo');
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(titleInput().element.value).toBe('Foo');
|
||||
|
||||
await glForm().trigger('reset');
|
||||
|
||||
expect(titleInput().element.value).toBe('');
|
||||
expect(wrapper.emitted('form-cancel')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -32,7 +32,7 @@ RSpec.describe Backup::GitalyBackup do
|
|||
project_snippet = create(:project_snippet, :repository, project: project)
|
||||
personal_snippet = create(:personal_snippet, :repository, author: project.owner)
|
||||
|
||||
expect(Process).to receive(:spawn).with(anything, 'create', '-path', anything, { in: anything, out: progress }).and_call_original
|
||||
expect(Open3).to receive(:popen2).with(ENV, anything, 'create', '-path', anything).and_call_original
|
||||
|
||||
subject.start(:create)
|
||||
subject.enqueue(project, Gitlab::GlRepository::PROJECT)
|
||||
|
@ -53,7 +53,7 @@ RSpec.describe Backup::GitalyBackup do
|
|||
let(:parallel) { 3 }
|
||||
|
||||
it 'passes parallel option through' do
|
||||
expect(Process).to receive(:spawn).with(anything, 'create', '-path', anything, '-parallel', '3', { in: anything, out: progress }).and_call_original
|
||||
expect(Open3).to receive(:popen2).with(ENV, anything, 'create', '-path', anything, '-parallel', '3').and_call_original
|
||||
|
||||
subject.start(:create)
|
||||
subject.wait
|
||||
|
@ -64,7 +64,7 @@ RSpec.describe Backup::GitalyBackup do
|
|||
let(:parallel_storage) { 3 }
|
||||
|
||||
it 'passes parallel option through' do
|
||||
expect(Process).to receive(:spawn).with(anything, 'create', '-path', anything, '-parallel-storage', '3', { in: anything, out: progress }).and_call_original
|
||||
expect(Open3).to receive(:popen2).with(ENV, anything, 'create', '-path', anything, '-parallel-storage', '3').and_call_original
|
||||
|
||||
subject.start(:create)
|
||||
subject.wait
|
||||
|
@ -109,7 +109,7 @@ RSpec.describe Backup::GitalyBackup do
|
|||
copy_bundle_to_backup_path('personal_snippet_repo.bundle', personal_snippet.disk_path + '.bundle')
|
||||
copy_bundle_to_backup_path('project_snippet_repo.bundle', project_snippet.disk_path + '.bundle')
|
||||
|
||||
expect(Process).to receive(:spawn).with(anything, 'restore', '-path', anything, { in: anything, out: progress }).and_call_original
|
||||
expect(Open3).to receive(:popen2).with(ENV, anything, 'restore', '-path', anything).and_call_original
|
||||
|
||||
subject.start(:restore)
|
||||
subject.enqueue(project, Gitlab::GlRepository::PROJECT)
|
||||
|
@ -132,7 +132,7 @@ RSpec.describe Backup::GitalyBackup do
|
|||
let(:parallel) { 3 }
|
||||
|
||||
it 'does not pass parallel option through' do
|
||||
expect(Process).to receive(:spawn).with(anything, 'restore', '-path', anything, { in: anything, out: progress }).and_call_original
|
||||
expect(Open3).to receive(:popen2).with(ENV, anything, 'restore', '-path', anything).and_call_original
|
||||
|
||||
subject.start(:restore)
|
||||
subject.wait
|
||||
|
|
|
@ -304,7 +304,7 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migrat
|
|||
end
|
||||
|
||||
def blob_at(snippet, path)
|
||||
raw_repository(snippet).blob_at('master', path)
|
||||
raw_repository(snippet).blob_at('main', path)
|
||||
end
|
||||
|
||||
def repository_exists?(snippet)
|
||||
|
|
|
@ -412,6 +412,16 @@ RSpec.describe 'gitlab:app namespace rake task', :delete do
|
|||
expect { run_rake_task('gitlab:backup:create') }.to output.to_stdout_from_any_process
|
||||
end
|
||||
end
|
||||
|
||||
context 'CRON env is set' do
|
||||
before do
|
||||
stub_env('CRON', '1')
|
||||
end
|
||||
|
||||
it 'does not output to stdout' do
|
||||
expect { run_rake_task('gitlab:backup:create') }.not_to output.to_stdout_from_any_process
|
||||
end
|
||||
end
|
||||
end
|
||||
# backup_create task
|
||||
|
||||
|
|
Loading…
Reference in a new issue