Commit 69de4417 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Adds transfer project specs

Adds jest test for the transfer project form
and updates the gitlab pot file.
parent ebd6e5fe
......@@ -31535,6 +31535,9 @@ msgstr ""
msgid "Select a milestone"
msgstr ""
msgid "Select a namespace"
msgstr ""
msgid "Select a new namespace"
msgstr ""
......
......@@ -16,11 +16,9 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do
visit edit_project_path(project)
page.within('.js-project-transfer-form') do
# page.find('.select2-container').click
page.find('[data-testid="transfer-project-namespace"]').click
end
# binding.pry
page.within('[data-testid="transfer-project-namespace"]') do
page.find("li button", text: group.full_name).click
end
......
import { namespaces } from 'jest/vue_shared/components/namespace_select/mock_data';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import TransferProjectForm from '~/projects/settings/components/transfer_project_form.vue';
import NamespaceSelect from '~/vue_shared/components/namespace_select/namespace_select.vue';
import ConfirmDanger from '~/vue_shared/components/confirm_danger/confirm_danger.vue';
describe('Transfer project form', () => {
let wrapper;
const confirmButtonText = 'Confirm';
const confirmationPhrase = 'You must construct additional pylons!';
const createComponent = () =>
shallowMountExtended(TransferProjectForm, {
propsData: {
namespaces,
confirmButtonText,
confirmationPhrase,
},
});
const findNamespaceSelect = () => wrapper.findComponent(NamespaceSelect);
const findConfirmDanger = () => wrapper.findComponent(ConfirmDanger);
beforeEach(() => {
wrapper = createComponent();
});
afterEach(() => {
wrapper.destroy();
});
it('renders the namespace selector', () => {
expect(findNamespaceSelect().exists()).toBe(true);
});
it('renders the confirm button', () => {
expect(findConfirmDanger().exists()).toBe(true);
});
it('disables the confirm button by default', () => {
expect(findConfirmDanger().attributes('disabled')).toBe('true');
});
describe('with a selected namespace', () => {
const [selectedItem] = namespaces.group;
beforeEach(() => {
findNamespaceSelect().vm.$emit('select', selectedItem);
});
it('emits the `selectNamespace` event when a namespace is selected', () => {
const args = [selectedItem.id];
expect(wrapper.emitted('selectNamespace')).toEqual([args]);
});
it('enables the confirm button', () => {
expect(findConfirmDanger().attributes('disabled')).toBeUndefined();
});
it('clicking the confirm button emits the `confirm` event', () => {
findConfirmDanger().vm.$emit('confirm');
expect(wrapper.emitted('confirm')).toBeDefined();
});
});
});
import { GlDropdown, GlDropdownItem, GlDropdownSectionHeader, GlSearchBoxByType } from '@gitlab/ui';
import { GlDropdown, GlDropdownItem, GlDropdownSectionHeader } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import NamespaceSelect, {
i18n,
......
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