diff options
Diffstat (limited to 'spec/frontend/packages_and_registries/shared/components')
12 files changed, 22 insertions, 111 deletions
diff --git a/spec/frontend/packages_and_registries/shared/components/__snapshots__/registry_breadcrumb_spec.js.snap b/spec/frontend/packages_and_registries/shared/components/__snapshots__/registry_breadcrumb_spec.js.snap index e6e89806ce0..e9ee6ebdb5c 100644 --- a/spec/frontend/packages_and_registries/shared/components/__snapshots__/registry_breadcrumb_spec.js.snap +++ b/spec/frontend/packages_and_registries/shared/components/__snapshots__/registry_breadcrumb_spec.js.snap @@ -5,7 +5,6 @@ exports[`Registry Breadcrumb when is not rootRoute renders 1`] = ` aria-label="Breadcrumb" class="gl-breadcrumbs" > - <ol class="breadcrumb gl-breadcrumb-list" > @@ -16,29 +15,10 @@ exports[`Registry Breadcrumb when is not rootRoute renders 1`] = ` class="" target="_self" > + <!----> <span> </span> - - <span - class="gl-breadcrumb-separator" - data-testid="separator" - > - <span - class="gl-mx-n5" - > - <svg - aria-hidden="true" - class="gl-icon s8" - data-testid="chevron-lg-right-icon" - role="img" - > - <use - href="#chevron-lg-right" - /> - </svg> - </span> - </span> </a> </li> @@ -52,11 +32,10 @@ exports[`Registry Breadcrumb when is not rootRoute renders 1`] = ` href="#" target="_self" > + <!----> <span> </span> - - <!----> </a> </li> @@ -70,7 +49,6 @@ exports[`Registry Breadcrumb when is rootRoute renders 1`] = ` aria-label="Breadcrumb" class="gl-breadcrumbs" > - <ol class="breadcrumb gl-breadcrumb-list" > @@ -82,11 +60,10 @@ exports[`Registry Breadcrumb when is rootRoute renders 1`] = ` class="" target="_self" > + <!----> <span> </span> - - <!----> </a> </li> diff --git a/spec/frontend/packages_and_registries/shared/components/cli_commands_spec.js b/spec/frontend/packages_and_registries/shared/components/cli_commands_spec.js index 18084766db9..41482e6e681 100644 --- a/spec/frontend/packages_and_registries/shared/components/cli_commands_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/cli_commands_spec.js @@ -38,11 +38,6 @@ describe('cli_commands', () => { mountComponent(); }); - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - it('shows the correct text on the button', () => { expect(findDropdownButton().text()).toContain(QUICK_START); }); diff --git a/spec/frontend/packages_and_registries/shared/components/delete_package_modal_spec.js b/spec/frontend/packages_and_registries/shared/components/delete_package_modal_spec.js index 357dab593e8..ba5ba8f9884 100644 --- a/spec/frontend/packages_and_registries/shared/components/delete_package_modal_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/delete_package_modal_spec.js @@ -19,11 +19,6 @@ describe('DeletePackageModal', () => { }); }; - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - describe('when itemToBeDeleted prop is defined', () => { beforeEach(() => { mountComponent(); diff --git a/spec/frontend/packages_and_registries/shared/components/package_icon_and_name_spec.js b/spec/frontend/packages_and_registries/shared/components/package_icon_and_name_spec.js deleted file mode 100644 index a0ff6ca01b5..00000000000 --- a/spec/frontend/packages_and_registries/shared/components/package_icon_and_name_spec.js +++ /dev/null @@ -1,32 +0,0 @@ -import { GlIcon } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import PackageIconAndName from '~/packages_and_registries/shared/components/package_icon_and_name.vue'; - -describe('PackageIconAndName', () => { - let wrapper; - - const findIcon = () => wrapper.findComponent(GlIcon); - - const mountComponent = () => { - wrapper = shallowMount(PackageIconAndName, { - slots: { - default: 'test', - }, - }); - }; - - it('has an icon', () => { - mountComponent(); - - const icon = findIcon(); - - expect(icon.exists()).toBe(true); - expect(icon.props('name')).toBe('package'); - }); - - it('renders the slot content', () => { - mountComponent(); - - expect(wrapper.text()).toBe('test'); - }); -}); diff --git a/spec/frontend/packages_and_registries/shared/components/package_path_spec.js b/spec/frontend/packages_and_registries/shared/components/package_path_spec.js index 93425d4f399..3ffbb6f435c 100644 --- a/spec/frontend/packages_and_registries/shared/components/package_path_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/package_path_spec.js @@ -9,7 +9,7 @@ describe('PackagePath', () => { wrapper = shallowMount(PackagePath, { propsData, directives: { - GlTooltip: createMockDirective(), + GlTooltip: createMockDirective('gl-tooltip'), }, }); }; @@ -24,11 +24,6 @@ describe('PackagePath', () => { const findItem = (name) => wrapper.find(`[data-testid="${name}"]`); const findTooltip = (w) => getBinding(w.element, 'gl-tooltip'); - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - describe.each` path | rootUrl | shouldExist | shouldNotExist ${'foo/bar'} | ${'/foo/bar'} | ${[]} | ${[ROOT_CHEVRON, ELLIPSIS_ICON, ELLIPSIS_CHEVRON, LEAF_LINK]} @@ -91,12 +86,12 @@ describe('PackagePath', () => { }); it('root link is disabled', () => { - expect(findItem(ROOT_LINK).attributes('disabled')).toBe('true'); + expect(findItem(ROOT_LINK).attributes('disabled')).toBeDefined(); }); if (shouldExist.includes(LEAF_LINK)) { it('the last link is disabled', () => { - expect(findItem(LEAF_LINK).attributes('disabled')).toBe('true'); + expect(findItem(LEAF_LINK).attributes('disabled')).toBeDefined(); }); } }); diff --git a/spec/frontend/packages_and_registries/shared/components/package_tags_spec.js b/spec/frontend/packages_and_registries/shared/components/package_tags_spec.js index 33e96c0775e..b025517ae47 100644 --- a/spec/frontend/packages_and_registries/shared/components/package_tags_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/package_tags_spec.js @@ -20,10 +20,6 @@ describe('PackageTags', () => { const tagBadges = () => wrapper.findAll('[data-testid="tagBadge"]'); const moreBadge = () => wrapper.find('[data-testid="moreBadge"]'); - afterEach(() => { - if (wrapper) wrapper.destroy(); - }); - describe('tag label', () => { it('shows the tag label by default', () => { createComponent(); diff --git a/spec/frontend/packages_and_registries/shared/components/packages_list_loader_spec.js b/spec/frontend/packages_and_registries/shared/components/packages_list_loader_spec.js index 0005162e0bb..e43a9f57255 100644 --- a/spec/frontend/packages_and_registries/shared/components/packages_list_loader_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/packages_list_loader_spec.js @@ -17,11 +17,6 @@ describe('PackagesListLoader', () => { beforeEach(createComponent); - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - describe('desktop loader', () => { it('produces the right loader', () => { expect(findDesktopShapes().findAll('rect[width="1000"]')).toHaveLength(20); diff --git a/spec/frontend/packages_and_registries/shared/components/persisted_search_spec.js b/spec/frontend/packages_and_registries/shared/components/persisted_search_spec.js index db9f96bff39..c1e86080d29 100644 --- a/spec/frontend/packages_and_registries/shared/components/persisted_search_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/persisted_search_spec.js @@ -43,10 +43,6 @@ describe('Persisted Search', () => { extractFilterAndSorting.mockReturnValue(defaultQueryParamsMock); }); - afterEach(() => { - wrapper.destroy(); - }); - it('has a registry search component', async () => { mountComponent(); @@ -55,7 +51,7 @@ describe('Persisted Search', () => { expect(findRegistrySearch().exists()).toBe(true); }); - it('registry search is mounted after mount', async () => { + it('registry search is mounted after mount', () => { mountComponent(); expect(findRegistrySearch().exists()).toBe(false); diff --git a/spec/frontend/packages_and_registries/shared/components/publish_method_spec.js b/spec/frontend/packages_and_registries/shared/components/publish_method_spec.js index fa8f8f7641a..167599a54ea 100644 --- a/spec/frontend/packages_and_registries/shared/components/publish_method_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/publish_method_spec.js @@ -20,11 +20,6 @@ describe('publish_method', () => { }); }; - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - it('renders', () => { mountComponent(packageWithPipeline); expect(wrapper.element).toMatchSnapshot(); diff --git a/spec/frontend/packages_and_registries/shared/components/registry_breadcrumb_spec.js b/spec/frontend/packages_and_registries/shared/components/registry_breadcrumb_spec.js index 15db454ac68..c1f1a25d53b 100644 --- a/spec/frontend/packages_and_registries/shared/components/registry_breadcrumb_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/registry_breadcrumb_spec.js @@ -31,10 +31,6 @@ describe('Registry Breadcrumb', () => { nameGenerator.mockClear(); }); - afterEach(() => { - wrapper.destroy(); - }); - describe('when is rootRoute', () => { beforeEach(() => { mountComponent(routes[0]); diff --git a/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js b/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js index 2e2d5e26d33..66fca2ce12e 100644 --- a/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js @@ -36,10 +36,6 @@ describe('Registry List', () => { const findScopedSlotFirstValue = (index) => findScopedSlots().at(index).find('span'); const findScopedSlotIsSelectedValue = (index) => findScopedSlots().at(index).find('p'); - afterEach(() => { - wrapper.destroy(); - }); - describe('header', () => { it('renders the title passed in the prop', () => { mountComponent(); @@ -62,7 +58,7 @@ describe('Registry List', () => { it('sets disabled prop to true when items length is 0', () => { mountComponent({ propsData: { ...defaultPropsData, items: [] } }); - expect(findSelectAll().attributes('disabled')).toBe('true'); + expect(findSelectAll().attributes('disabled')).toBeDefined(); }); it('when few are selected, sets indeterminate prop to true', async () => { @@ -111,10 +107,21 @@ describe('Registry List', () => { expect(findDeleteSelected().text()).toBe(component.i18n.deleteSelected); }); - it('is hidden when hiddenDelete is true', () => { - mountComponent({ propsData: { ...defaultPropsData, hiddenDelete: true } }); + describe('when hiddenDelete is true', () => { + beforeEach(() => { + mountComponent({ propsData: { ...defaultPropsData, hiddenDelete: true } }); + }); - expect(findDeleteSelected().exists()).toBe(false); + it('is hidden', () => { + expect(findDeleteSelected().exists()).toBe(false); + }); + + it('populates the first slot prop correctly', () => { + expect(findScopedSlots().at(0).exists()).toBe(true); + + // it's the first slot + expect(findScopedSlotFirstValue(0).text()).toBe('false'); + }); }); it('is disabled when isLoading is true', () => { diff --git a/spec/frontend/packages_and_registries/shared/components/settings_block_spec.js b/spec/frontend/packages_and_registries/shared/components/settings_block_spec.js index a4c1b989dac..664a821c275 100644 --- a/spec/frontend/packages_and_registries/shared/components/settings_block_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/settings_block_spec.js @@ -15,10 +15,6 @@ describe('SettingsBlock', () => { }); }; - afterEach(() => { - wrapper.destroy(); - }); - const findDefaultSlot = () => wrapper.findByTestId('default-slot'); const findTitleSlot = () => wrapper.findByTestId('title-slot'); const findDescriptionSlot = () => wrapper.findByTestId('description-slot'); |