diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-18 12:15:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-18 12:15:50 +0300 |
commit | 5d7b3c05e5c502d090a13515dc5cdaf6b647f215 (patch) | |
tree | 317a34626ee210ce687f941f75d512b32b015c4d /spec/frontend/packages_and_registries | |
parent | 20ab32fe1094c9781e5b39381412898b6dce6657 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/packages_and_registries')
-rw-r--r-- | spec/frontend/packages_and_registries/dependency_proxy/app_spec.js | 33 | ||||
-rw-r--r-- | spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js | 19 |
2 files changed, 17 insertions, 35 deletions
diff --git a/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js b/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js index c2ae34ce697..2e7195aa59b 100644 --- a/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js +++ b/spec/frontend/packages_and_registries/dependency_proxy/app_spec.js @@ -5,7 +5,6 @@ import { GlFormInputGroup, GlFormGroup, GlModal, - GlSkeletonLoader, GlSprintf, GlEmptyState, } from '@gitlab/ui'; @@ -72,8 +71,6 @@ describe('DependencyProxyApp', () => { const findClipBoardButton = () => wrapper.findComponent(ClipboardButton); const findFormGroup = () => wrapper.findComponent(GlFormGroup); const findFormInputGroup = () => wrapper.findComponent(GlFormInputGroup); - const findSkeletonLoader = () => wrapper.findComponent(GlSkeletonLoader); - const findMainArea = () => wrapper.findByTestId('main-area'); const findProxyCountText = () => wrapper.findByTestId('proxy-count'); const findManifestList = () => wrapper.findComponent(ManifestsList); const findEmptyState = () => wrapper.findComponent(GlEmptyState); @@ -99,23 +96,11 @@ describe('DependencyProxyApp', () => { describe('when the dependency proxy is available', () => { describe('when is loading', () => { - it('renders the skeleton loader', () => { - createComponent(); - - expect(findSkeletonLoader().exists()).toBe(true); - }); - it('does not render a form group with label', () => { createComponent(); expect(findFormGroup().exists()).toBe(false); }); - - it('does not show the main section', () => { - createComponent(); - - expect(findMainArea().exists()).toBe(false); - }); }); describe('when the app is loaded', () => { @@ -125,10 +110,6 @@ describe('DependencyProxyApp', () => { return waitForPromises(); }); - it('renders the main area', () => { - expect(findMainArea().exists()).toBe(true); - }); - it('renders a form group with a label', () => { expect(findFormGroup().attributes('label')).toBe( DependencyProxyApp.i18n.proxyImagePrefix, @@ -213,13 +194,6 @@ describe('DependencyProxyApp', () => { }); describe('triggering page event on list', () => { - it('re-renders the skeleton loader', async () => { - findManifestList().vm.$emit('next-page'); - await nextTick(); - - expect(findSkeletonLoader().exists()).toBe(true); - }); - it('renders form group with label', async () => { findManifestList().vm.$emit('next-page'); await nextTick(); @@ -228,13 +202,6 @@ describe('DependencyProxyApp', () => { expect.stringMatching(DependencyProxyApp.i18n.proxyImagePrefix), ); }); - - it('does not show the main section', async () => { - findManifestList().vm.$emit('next-page'); - await nextTick(); - - expect(findMainArea().exists()).toBe(false); - }); }); it('shows the clear cache dropdown list', () => { diff --git a/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js b/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js index 639a4fbb99d..0d8af42bae3 100644 --- a/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js +++ b/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js @@ -1,7 +1,6 @@ -import { GlKeysetPagination } from '@gitlab/ui'; +import { GlKeysetPagination, GlSkeletonLoader } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import ManifestRow from '~/packages_and_registries/dependency_proxy/components/manifest_row.vue'; - import Component from '~/packages_and_registries/dependency_proxy/components/manifests_list.vue'; import { proxyManifests, @@ -14,6 +13,7 @@ describe('Manifests List', () => { const defaultProps = { manifests: proxyManifests(), pagination: pagination(), + loading: false, }; const createComponent = (propsData = defaultProps) => { @@ -24,6 +24,8 @@ describe('Manifests List', () => { const findRows = () => wrapper.findAllComponents(ManifestRow); const findPagination = () => wrapper.findComponent(GlKeysetPagination); + const findMainArea = () => wrapper.findByTestId('main-area'); + const findSkeletonLoader = () => wrapper.findComponent(GlSkeletonLoader); it('has the correct title', () => { createComponent(); @@ -45,6 +47,19 @@ describe('Manifests List', () => { }); }); + describe('loading', () => { + it.each` + loading | expectLoader | expectContent + ${false} | ${false} | ${true} + ${true} | ${true} | ${false} + `('when loading is $loading', ({ loading, expectLoader, expectContent }) => { + createComponent({ ...defaultProps, loading }); + + expect(findSkeletonLoader().exists()).toBe(expectLoader); + expect(findMainArea().exists()).toBe(expectContent); + }); + }); + describe('pagination', () => { it('is hidden when there is no next or prev pages', () => { createComponent({ ...defaultProps, pagination: {} }); |