From 2bfa43cf3a8b0bb25a85066ff48db58f068bc493 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 1 Aug 2022 06:12:25 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/frontend/groups/components/group_item_spec.js | 49 ++++++++++++++-------- spec/frontend/groups/components/groups_spec.js | 4 +- 2 files changed, 33 insertions(+), 20 deletions(-) (limited to 'spec/frontend/groups') diff --git a/spec/frontend/groups/components/group_item_spec.js b/spec/frontend/groups/components/group_item_spec.js index 0bc80df6535..9906f62878f 100644 --- a/spec/frontend/groups/components/group_item_spec.js +++ b/spec/frontend/groups/components/group_item_spec.js @@ -6,19 +6,20 @@ import ItemActions from '~/groups/components/item_actions.vue'; import eventHub from '~/groups/event_hub'; import { getGroupItemMicrodata } from '~/groups/store/utils'; import * as urlUtilities from '~/lib/utils/url_utility'; +import { ITEM_TYPE } from '~/groups/constants'; import { - ITEM_TYPE, - VISIBILITY_INTERNAL, - VISIBILITY_PRIVATE, - VISIBILITY_PUBLIC, -} from '~/groups/constants'; -import { mountExtended } from 'helpers/vue_test_utils_helper'; + VISIBILITY_LEVEL_PRIVATE, + VISIBILITY_LEVEL_INTERNAL, + VISIBILITY_LEVEL_PUBLIC, +} from '~/visibility_level/constants'; +import { helpPagePath } from '~/helpers/help_page_helper'; +import { mountExtended, extendedWrapper } from 'helpers/vue_test_utils_helper'; import { mockParentGroupItem, mockChildren } from '../mock_data'; const createComponent = ( propsData = { group: mockParentGroupItem, parentGroup: mockChildren[0] }, provide = { - currentGroupVisibility: VISIBILITY_PRIVATE, + currentGroupVisibility: VISIBILITY_LEVEL_PRIVATE, }, ) => { return mountExtended(GroupItem, { @@ -289,7 +290,7 @@ describe('GroupItemComponent', () => { }); describe('visibility warning popover', () => { - const findPopover = () => wrapper.findComponent(GlPopover); + const findPopover = () => extendedWrapper(wrapper.findComponent(GlPopover)); const itDoesNotRenderVisibilityWarningPopover = () => { it('does not render visibility warning popover', () => { @@ -319,13 +320,16 @@ describe('GroupItemComponent', () => { describe('when showing projects', () => { describe.each` - itemVisibility | currentGroupVisibility | isPopoverShown - ${VISIBILITY_PRIVATE} | ${VISIBILITY_PUBLIC} | ${false} - ${VISIBILITY_INTERNAL} | ${VISIBILITY_PUBLIC} | ${false} - ${VISIBILITY_PUBLIC} | ${VISIBILITY_PUBLIC} | ${false} - ${VISIBILITY_PRIVATE} | ${VISIBILITY_PRIVATE} | ${false} - ${VISIBILITY_INTERNAL} | ${VISIBILITY_PRIVATE} | ${true} - ${VISIBILITY_PUBLIC} | ${VISIBILITY_PRIVATE} | ${true} + itemVisibility | currentGroupVisibility | isPopoverShown + ${VISIBILITY_LEVEL_PRIVATE} | ${VISIBILITY_LEVEL_PUBLIC} | ${false} + ${VISIBILITY_LEVEL_INTERNAL} | ${VISIBILITY_LEVEL_PUBLIC} | ${false} + ${VISIBILITY_LEVEL_PUBLIC} | ${VISIBILITY_LEVEL_PUBLIC} | ${false} + ${VISIBILITY_LEVEL_PRIVATE} | ${VISIBILITY_LEVEL_PRIVATE} | ${false} + ${VISIBILITY_LEVEL_INTERNAL} | ${VISIBILITY_LEVEL_PRIVATE} | ${true} + ${VISIBILITY_LEVEL_PUBLIC} | ${VISIBILITY_LEVEL_PRIVATE} | ${true} + ${VISIBILITY_LEVEL_PRIVATE} | ${VISIBILITY_LEVEL_INTERNAL} | ${false} + ${VISIBILITY_LEVEL_INTERNAL} | ${VISIBILITY_LEVEL_INTERNAL} | ${false} + ${VISIBILITY_LEVEL_PUBLIC} | ${VISIBILITY_LEVEL_INTERNAL} | ${true} `( 'when item visibility is $itemVisibility and parent group visibility is $currentGroupVisibility', ({ itemVisibility, currentGroupVisibility, isPopoverShown }) => { @@ -347,8 +351,17 @@ describe('GroupItemComponent', () => { }); if (isPopoverShown) { - it('renders visibility warning popover', () => { - expect(findPopover().exists()).toBe(true); + it('renders visibility warning popover with `Learn more` link', () => { + const popover = findPopover(); + + expect(popover.exists()).toBe(true); + expect( + popover.findByRole('link', { name: GroupItem.i18n.learnMore }).attributes('href'), + ).toBe( + helpPagePath('user/project/members/share_project_with_groups', { + anchor: 'sharing-projects-with-groups-of-a-higher-restrictive-visibility-level', + }), + ); }); } else { itDoesNotRenderVisibilityWarningPopover(); @@ -361,7 +374,7 @@ describe('GroupItemComponent', () => { wrapper = createComponent({ group: { ...mockParentGroupItem, - visibility: VISIBILITY_PUBLIC, + visibility: VISIBILITY_LEVEL_PUBLIC, type: ITEM_TYPE.PROJECT, }, parentGroup: mockChildren[0], diff --git a/spec/frontend/groups/components/groups_spec.js b/spec/frontend/groups/components/groups_spec.js index 48a2319cf96..6c1eb373b7e 100644 --- a/spec/frontend/groups/components/groups_spec.js +++ b/spec/frontend/groups/components/groups_spec.js @@ -6,7 +6,7 @@ import GroupItemComponent from '~/groups/components/group_item.vue'; import PaginationLinks from '~/vue_shared/components/pagination_links.vue'; import GroupsComponent from '~/groups/components/groups.vue'; import eventHub from '~/groups/event_hub'; -import { VISIBILITY_PRIVATE } from '~/groups/constants'; +import { VISIBILITY_LEVEL_PRIVATE } from '~/visibility_level/constants'; import { mockGroups, mockPageInfo } from '../mock_data'; describe('GroupsComponent', () => { @@ -26,7 +26,7 @@ describe('GroupsComponent', () => { ...propsData, }, provide: { - currentGroupVisibility: VISIBILITY_PRIVATE, + currentGroupVisibility: VISIBILITY_LEVEL_PRIVATE, }, }); }; -- cgit v1.2.3