diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-10 18:10:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-10 18:10:45 +0300 |
commit | aaabf6eb167d1a0bb2357f331bd411923ede37a6 (patch) | |
tree | 8ac099b00a88bbad79361c0688227210aa1e1973 /spec/frontend/packages_and_registries/package_registry/components/list | |
parent | 1c00bf77814669d7d35c8aede82553c7e8883e18 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/packages_and_registries/package_registry/components/list')
2 files changed, 47 insertions, 28 deletions
diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap b/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap index 7a488a74dcb..e0e6c101029 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap +++ b/spec/frontend/packages_and_registries/package_registry/components/list/__snapshots__/package_list_row_spec.js.snap @@ -104,35 +104,33 @@ exports[`packages_list_row renders 1`] = ` <div class="gl-w-9 gl-display-flex gl-justify-content-end gl-pr-1" > - <gl-dropdown-stub + <gl-disclosure-dropdown-stub + autoclose="true" category="tertiary" - clearalltext="Clear all" - clearalltextclass="gl-px-5" data-testid="delete-dropdown" - headertext="" - hideheaderborder="true" - highlighteditemstitle="Selected" - highlighteditemstitleclass="gl-px-5" icon="ellipsis_v" - no-caret="" + items="" + nocaret="true" + placement="left" + positioningstrategy="absolute" size="medium" - text="More actions" textsronly="true" + toggleid="dropdown-toggle-btn-3" + toggletext="More actions" variant="default" > - <gl-dropdown-item-stub - avatarurl="" + <gl-disclosure-dropdown-item-stub data-testid="action-delete" - iconcolor="" - iconname="" - iconrightarialabel="" - iconrightname="" - secondarytext="" - variant="danger" > - Delete package - </gl-dropdown-item-stub> - </gl-dropdown-stub> + <span + class="gl-text-red-500" + > + + Delete package + + </span> + </gl-disclosure-dropdown-item-stub> + </gl-disclosure-dropdown-stub> </div> </div> diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js b/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js index 523d5f855fc..9f8fd4e28e7 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/list/package_list_row_spec.js @@ -34,7 +34,8 @@ describe('packages_list_row', () => { const packageWithTags = { ...packageWithoutTags, tags: { nodes: packageTags() } }; const findPackageTags = () => wrapper.findComponent(PackageTags); - const findDeleteDropdown = () => wrapper.findByTestId('action-delete'); + const findDeleteDropdown = () => wrapper.findByTestId('delete-dropdown'); + const findDeleteButton = () => wrapper.findByTestId('action-delete'); const findPackageType = () => wrapper.findByTestId('package-type'); const findPackageLink = () => wrapper.findByTestId('details-link'); const findWarningIcon = () => wrapper.findByTestId('warning-icon'); @@ -103,7 +104,7 @@ describe('packages_list_row', () => { }); }); - describe('delete button', () => { + describe('delete dropdown', () => { it('does not exist when package cannot be destroyed', () => { mountComponent({ packageEntity: { ...packageWithoutTags, canDestroy: false }, @@ -112,19 +113,39 @@ describe('packages_list_row', () => { expect(findDeleteDropdown().exists()).toBe(false); }); - it('exists and has the correct props', () => { - mountComponent({ packageEntity: packageWithoutTags }); + it('exists when package can be destroyed', () => { + mountComponent(); - expect(findDeleteDropdown().exists()).toBe(true); - expect(findDeleteDropdown().attributes()).toMatchObject({ - variant: 'danger', + expect(findDeleteDropdown().props()).toMatchObject({ + category: 'tertiary', + icon: 'ellipsis_v', + textSrOnly: true, + noCaret: true, + toggleText: 'More actions', }); }); + }); + + describe('delete button', () => { + it('does not exist when package cannot be destroyed', () => { + mountComponent({ + packageEntity: { ...packageWithoutTags, canDestroy: false }, + }); + + expect(findDeleteButton().exists()).toBe(false); + }); + + it('exists and has the correct text', () => { + mountComponent({ packageEntity: packageWithoutTags }); + + expect(findDeleteButton().exists()).toBe(true); + expect(findDeleteButton().text()).toBe('Delete package'); + }); it('emits the delete event when the delete button is clicked', () => { mountComponent({ packageEntity: packageWithoutTags }); - findDeleteDropdown().vm.$emit('click'); + findDeleteButton().vm.$emit('action'); expect(wrapper.emitted('delete')).toHaveLength(1); }); |