diff options
Diffstat (limited to 'spec/frontend/ci/artifacts/components/artifact_row_spec.js')
-rw-r--r-- | spec/frontend/ci/artifacts/components/artifact_row_spec.js | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/spec/frontend/ci/artifacts/components/artifact_row_spec.js b/spec/frontend/ci/artifacts/components/artifact_row_spec.js index 96ddedc3a9d..8bf1138bc85 100644 --- a/spec/frontend/ci/artifacts/components/artifact_row_spec.js +++ b/spec/frontend/ci/artifacts/components/artifact_row_spec.js @@ -4,7 +4,7 @@ import { numberToHumanSize } from '~/lib/utils/number_utils'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; import ArtifactRow from '~/ci/artifacts/components/artifact_row.vue'; -import { BULK_DELETE_FEATURE_FLAG, I18N_BULK_DELETE_MAX_SELECTED } from '~/ci/artifacts/constants'; +import { I18N_BULK_DELETE_MAX_SELECTED } from '~/ci/artifacts/constants'; describe('ArtifactRow component', () => { let wrapper; @@ -18,7 +18,7 @@ describe('ArtifactRow component', () => { const findDeleteButton = () => wrapper.findByTestId('job-artifact-row-delete-button'); const findCheckbox = () => wrapper.findComponent(GlFormCheckbox); - const createComponent = ({ canDestroyArtifacts = true, glFeatures = {}, props = {} } = {}) => { + const createComponent = ({ canDestroyArtifacts = true, props = {} } = {}) => { wrapper = shallowMountExtended(ArtifactRow, { propsData: { artifact, @@ -28,7 +28,7 @@ describe('ArtifactRow component', () => { isSelectedArtifactsLimitReached: false, ...props, }, - provide: { canDestroyArtifacts, glFeatures }, + provide: { canDestroyArtifacts }, stubs: { GlBadge, GlFriendlyWrap }, }); }; @@ -80,35 +80,31 @@ describe('ArtifactRow component', () => { }); describe('bulk delete checkbox', () => { - describe('with permission and feature flag enabled', () => { - it('emits selectArtifact when toggled', () => { - createComponent({ glFeatures: { [BULK_DELETE_FEATURE_FLAG]: true } }); - - findCheckbox().vm.$emit('input', true); + it('emits selectArtifact when toggled', () => { + createComponent(); - expect(wrapper.emitted('selectArtifact')).toStrictEqual([[artifact, true]]); - }); + findCheckbox().vm.$emit('input', true); - describe('when the selected artifacts limit is reached', () => { - it('remains enabled if the artifact was selected', () => { - createComponent({ - glFeatures: { [BULK_DELETE_FEATURE_FLAG]: true }, - props: { isSelected: true, isSelectedArtifactsLimitReached: true }, - }); + expect(wrapper.emitted('selectArtifact')).toStrictEqual([[artifact, true]]); + }); - expect(findCheckbox().attributes('disabled')).toBeUndefined(); - expect(findCheckbox().attributes('title')).toBe(''); + describe('when the selected artifacts limit is reached', () => { + it('remains enabled if the artifact was selected', () => { + createComponent({ + props: { isSelected: true, isSelectedArtifactsLimitReached: true }, }); - it('is disabled if the artifact was not selected', () => { - createComponent({ - glFeatures: { [BULK_DELETE_FEATURE_FLAG]: true }, - props: { isSelected: false, isSelectedArtifactsLimitReached: true }, - }); + expect(findCheckbox().attributes('disabled')).toBeUndefined(); + expect(findCheckbox().attributes('title')).toBe(''); + }); - expect(findCheckbox().attributes('disabled')).toBeDefined(); - expect(findCheckbox().attributes('title')).toBe(I18N_BULK_DELETE_MAX_SELECTED); + it('is disabled if the artifact was not selected', () => { + createComponent({ + props: { isSelected: false, isSelectedArtifactsLimitReached: true }, }); + + expect(findCheckbox().attributes('disabled')).toBeDefined(); + expect(findCheckbox().attributes('title')).toBe(I18N_BULK_DELETE_MAX_SELECTED); }); }); @@ -117,11 +113,5 @@ describe('ArtifactRow component', () => { expect(findCheckbox().exists()).toBe(false); }); - - it('is not shown with feature flag disabled', () => { - createComponent(); - - expect(findCheckbox().exists()).toBe(false); - }); }); }); |