Commit 9551fabd authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Hide empty namespace without a search match

Minor cleanup jest tests

Addresses some minor review comments with
the jest tests for the transfer group form.
parent 81482ff7
......@@ -41,7 +41,7 @@ export default () => {
},
on: {
confirm: () => {
if (targetFormId) document.getElementById(targetFormId)?.submit();
document.getElementById(targetFormId)?.submit();
},
},
});
......
......@@ -83,6 +83,10 @@ export default {
selectedNamespaceText() {
return this.selectedNamespace?.humanName || this.defaultText;
},
filteredEmptyNamespaceTitle() {
const { includeEmptyNamespace, emptyNamespaceTitle, searchTerm } = this;
return includeEmptyNamespace && emptyNamespaceTitle.toLowerCase().includes(searchTerm);
},
},
methods: {
handleSelect(item) {
......@@ -101,7 +105,7 @@ export default {
<template #header>
<gl-search-box-by-type v-model.trim="searchTerm" />
</template>
<div v-if="includeEmptyNamespace">
<div v-if="filteredEmptyNamespaceTitle">
<gl-dropdown-item
data-qa-selector="namespaces_list_item"
@click="handleSelectEmptyNamespace()"
......
......@@ -17346,9 +17346,6 @@ msgstr ""
msgid "GroupSettings|There was a problem updating the pipeline settings: %{error_messages}."
msgstr ""
msgid "GroupSettings|This group can't be transferred because it is linked to a subscription. To transfer this group, %{linkStart}link the subscription%{linkEnd} with a different group."
msgstr ""
msgid "GroupSettings|This setting is applied on %{ancestor_group} and has been overridden on this subgroup."
msgstr ""
......@@ -36629,6 +36626,9 @@ msgstr ""
msgid "This group can't be removed because it is linked to a subscription. To remove this group, %{linkStart}link the subscription%{linkEnd} with a different group."
msgstr ""
msgid "This group can't be transfered because it is linked to a subscription. To transfer this group, %{linkStart}link the subscription%{linkEnd} with a different group."
msgstr ""
msgid "This group cannot be invited to a project inside a group with enforced SSO"
msgstr ""
......
import { GlAlert, GlSprintf } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import Component, { i18n } from '~/groups/components/transfer_group_form.vue';
import Component from '~/groups/components/transfer_group_form.vue';
import ConfirmDanger from '~/vue_shared/components/confirm_danger/confirm_danger.vue';
import NamespaceSelect from '~/vue_shared/components/namespace_select/namespace_select.vue';
......@@ -43,14 +43,15 @@ describe('Transfer group form', () => {
const findNamespaceSelect = () => wrapper.findComponent(NamespaceSelect);
const findHiddenInput = () => wrapper.find('[name="new_parent_group_id"]');
beforeEach(() => {
wrapper = createComponent();
});
afterEach(() => {
wrapper.destroy();
});
describe('default', () => {
beforeEach(() => {
wrapper = createComponent();
});
it('renders the namespace select component', () => {
expect(findNamespaceSelect().exists()).toBe(true);
});
......@@ -87,10 +88,12 @@ describe('Transfer group form', () => {
phrase: confirmationPhrase,
});
});
});
describe('with a selected project', () => {
const [firstGroup] = groups;
beforeEach(() => {
wrapper = createComponent();
findNamespaceSelect().vm.$emit('select', firstGroup);
});
......@@ -117,14 +120,6 @@ describe('Transfer group form', () => {
wrapper = createComponent({ isPaidGroup: true });
});
it('renders a warning alert with a link for additional information', () => {
expect(findAlert().text()).toMatchInterpolatedText(i18n.paidGroupMessage);
expect(findAlert().props()).toMatchObject({
dismissible: false,
variant: 'warning',
});
});
it('disables the transfer button', () => {
expect(findConfirmDanger().props()).toMatchObject({ disabled: true });
});
......
import { nextTick } from 'vue';
import { GlDropdown, GlDropdownItem, GlDropdownSectionHeader } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import NamespaceSelect, {
......@@ -99,12 +100,12 @@ describe('Namespace Select', () => {
describe('with an empty namespace option', () => {
const emptyNamespaceTitle = 'No namespace selected';
beforeEach(() => {
beforeEach(async () => {
wrapper = createComponent({
includeEmptyNamespace: true,
emptyNamespaceTitle,
});
return wrapper.vm.$nextTick();
await nextTick();
});
it('includes the empty namespace', () => {
......
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