diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/frontend/members | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/frontend/members')
-rw-r--r-- | spec/frontend/members/components/members_tabs_spec.js | 14 | ||||
-rw-r--r-- | spec/frontend/members/components/table/members_table_spec.js | 31 | ||||
-rw-r--r-- | spec/frontend/members/index_spec.js | 2 | ||||
-rw-r--r-- | spec/frontend/members/utils_spec.js | 2 |
4 files changed, 27 insertions, 22 deletions
diff --git a/spec/frontend/members/components/members_tabs_spec.js b/spec/frontend/members/components/members_tabs_spec.js index 1d882e5ef09..1354b938d77 100644 --- a/spec/frontend/members/components/members_tabs_spec.js +++ b/spec/frontend/members/components/members_tabs_spec.js @@ -9,6 +9,7 @@ import { MEMBER_TYPES, TAB_QUERY_PARAM_VALUES, ACTIVE_TAB_QUERY_PARAM_NAME, + FILTERED_SEARCH_TOKEN_GROUPS_WITH_INHERITED_PERMISSIONS, } from '~/members/constants'; import { pagination } from '../mock_data'; @@ -42,6 +43,7 @@ describe('MembersTabs', () => { }, filteredSearchBar: { searchParam: 'search_groups', + tokens: [FILTERED_SEARCH_TOKEN_GROUPS_WITH_INHERITED_PERMISSIONS.type], }, }, }, @@ -163,6 +165,18 @@ describe('MembersTabs', () => { expect(findTabByText('Groups')).not.toBeUndefined(); }); }); + + describe('when url param matches `filteredSearchBar.tokens`', () => { + beforeEach(() => { + setWindowLocation('?groups_with_inherited_permissions=exclude'); + }); + + it('shows tab that corresponds to filtered search token', async () => { + await createComponent({ totalItems: 0 }); + + expect(findTabByText('Groups')).not.toBeUndefined(); + }); + }); }); describe('when `canManageMembers` is `false`', () => { diff --git a/spec/frontend/members/components/table/members_table_spec.js b/spec/frontend/members/components/table/members_table_spec.js index 298a01e4f4d..08baa663bf0 100644 --- a/spec/frontend/members/components/table/members_table_spec.js +++ b/spec/frontend/members/components/table/members_table_spec.js @@ -16,12 +16,11 @@ import { MEMBER_STATE_CREATED, MEMBER_STATE_AWAITING, MEMBER_STATE_ACTIVE, - USER_STATE_BLOCKED_PENDING_APPROVAL, - BADGE_LABELS_AWAITING_USER_SIGNUP, - BADGE_LABELS_PENDING_OWNER_APPROVAL, + USER_STATE_BLOCKED, + BADGE_LABELS_AWAITING_SIGNUP, + BADGE_LABELS_PENDING, TAB_QUERY_PARAM_VALUES, } from '~/members/constants'; -import * as initUserPopovers from '~/user_popovers'; import { member as memberMock, directMember, @@ -134,14 +133,14 @@ describe('MembersTable', () => { describe('Invited column', () => { describe.each` - state | userState | expectedBadgeLabel - ${MEMBER_STATE_CREATED} | ${null} | ${BADGE_LABELS_AWAITING_USER_SIGNUP} - ${MEMBER_STATE_CREATED} | ${USER_STATE_BLOCKED_PENDING_APPROVAL} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL} - ${MEMBER_STATE_AWAITING} | ${''} | ${BADGE_LABELS_AWAITING_USER_SIGNUP} - ${MEMBER_STATE_AWAITING} | ${USER_STATE_BLOCKED_PENDING_APPROVAL} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL} - ${MEMBER_STATE_AWAITING} | ${'something_else'} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL} - ${MEMBER_STATE_ACTIVE} | ${null} | ${''} - ${MEMBER_STATE_ACTIVE} | ${'something_else'} | ${''} + state | userState | expectedBadgeLabel + ${MEMBER_STATE_CREATED} | ${null} | ${BADGE_LABELS_AWAITING_SIGNUP} + ${MEMBER_STATE_CREATED} | ${USER_STATE_BLOCKED} | ${BADGE_LABELS_PENDING} + ${MEMBER_STATE_AWAITING} | ${''} | ${BADGE_LABELS_AWAITING_SIGNUP} + ${MEMBER_STATE_AWAITING} | ${USER_STATE_BLOCKED} | ${BADGE_LABELS_PENDING} + ${MEMBER_STATE_AWAITING} | ${'something_else'} | ${BADGE_LABELS_PENDING} + ${MEMBER_STATE_ACTIVE} | ${null} | ${''} + ${MEMBER_STATE_ACTIVE} | ${'something_else'} | ${''} `('Invited Badge', ({ state, userState, expectedBadgeLabel }) => { it(`${ expectedBadgeLabel ? 'shows' : 'hides' @@ -257,14 +256,6 @@ describe('MembersTable', () => { }); }); - it('initializes user popovers when mounted', () => { - const initUserPopoversMock = jest.spyOn(initUserPopovers, 'default'); - - createComponent(); - - expect(initUserPopoversMock).toHaveBeenCalled(); - }); - it('adds QA selector to table', () => { createComponent(); diff --git a/spec/frontend/members/index_spec.js b/spec/frontend/members/index_spec.js index efabe54f238..251a8b0b774 100644 --- a/spec/frontend/members/index_spec.js +++ b/spec/frontend/members/index_spec.js @@ -24,7 +24,7 @@ describe('initMembersApp', () => { beforeEach(() => { el = document.createElement('div'); - el.setAttribute('data-members-data', dataAttribute); + el.dataset.membersData = dataAttribute; window.gon = { current_user_id: 123 }; }); diff --git a/spec/frontend/members/utils_spec.js b/spec/frontend/members/utils_spec.js index a157cfa1c1d..b0c9459ff4f 100644 --- a/spec/frontend/members/utils_spec.js +++ b/spec/frontend/members/utils_spec.js @@ -256,7 +256,7 @@ describe('Members Utils', () => { beforeEach(() => { el = document.createElement('div'); - el.setAttribute('data-members-data', dataAttribute); + el.dataset.membersData = dataAttribute; }); afterEach(() => { |