diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-18 20:02:30 +0000 |
commit | 41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch) | |
tree | 9c8d89a8624828992f06d892cd2f43818ff5dcc8 /spec/frontend/members | |
parent | 0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff) | |
download | gitlab-ce-41fe97390ceddf945f3d967b8fdb3de4c66b7dea.tar.gz |
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'spec/frontend/members')
-rw-r--r-- | spec/frontend/members/components/action_buttons/user_action_buttons_spec.js | 10 | ||||
-rw-r--r-- | spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js | 54 |
2 files changed, 22 insertions, 42 deletions
diff --git a/spec/frontend/members/components/action_buttons/user_action_buttons_spec.js b/spec/frontend/members/components/action_buttons/user_action_buttons_spec.js index 356df7e7b11..3e4ffb6e61b 100644 --- a/spec/frontend/members/components/action_buttons/user_action_buttons_spec.js +++ b/spec/frontend/members/components/action_buttons/user_action_buttons_spec.js @@ -43,12 +43,12 @@ describe('UserActionButtons', () => { memberId: member.id, memberType: 'GroupMember', message: `Are you sure you want to remove ${member.user.name} from "${member.source.fullName}"?`, - title: 'Remove member', + title: null, isAccessRequest: false, isInvite: false, icon: '', buttonCategory: 'secondary', - buttonText: 'Remove user', + buttonText: 'Remove member', userDeletionObstacles: { name: member.user.name, obstacles: parseUserDeletionObstacles(member.user), @@ -135,9 +135,9 @@ describe('UserActionButtons', () => { describe('isInvitedUser', () => { it.each` - isInvitedUser | icon | buttonText | buttonCategory - ${true} | ${'remove'} | ${null} | ${'primary'} - ${false} | ${''} | ${'Remove user'} | ${'secondary'} + isInvitedUser | icon | buttonText | buttonCategory + ${true} | ${'remove'} | ${null} | ${'primary'} + ${false} | ${''} | ${'Remove member'} | ${'secondary'} `( 'passes the correct props to remove-member-button when isInvitedUser is $isInvitedUser', ({ isInvitedUser, icon, buttonText, buttonCategory }) => { diff --git a/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js b/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js index ee2fbbe57b9..b692eea4aa5 100644 --- a/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js +++ b/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js @@ -1,12 +1,14 @@ -import { GlFilteredSearchToken } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; import setWindowLocation from 'helpers/set_window_location_helper'; import { redirectTo } from '~/lib/utils/url_utility'; import MembersFilteredSearchBar from '~/members/components/filter_sort/members_filtered_search_bar.vue'; -import { MEMBER_TYPES } from '~/members/constants'; -import { OPERATOR_IS_ONLY } from '~/vue_shared/components/filtered_search_bar/constants'; +import { + MEMBER_TYPES, + FILTERED_SEARCH_TOKEN_TWO_FACTOR, + FILTERED_SEARCH_TOKEN_WITH_INHERITED_PERMISSIONS, +} from '~/members/constants'; import FilteredSearchBar from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; jest.mock('~/lib/utils/url_utility', () => { @@ -32,7 +34,7 @@ describe('MembersFilteredSearchBar', () => { state: { filteredSearchBar: { show: true, - tokens: ['two_factor'], + tokens: [FILTERED_SEARCH_TOKEN_TWO_FACTOR.type], searchParam: 'search', placeholder: 'Filter members', recentSearchesStorageKey: 'group_members', @@ -70,21 +72,7 @@ describe('MembersFilteredSearchBar', () => { it('includes tokens set in `filteredSearchBar.tokens`', () => { createComponent(); - expect(findFilteredSearchBar().props('tokens')).toEqual([ - { - type: 'two_factor', - icon: 'lock', - title: '2FA', - token: GlFilteredSearchToken, - unique: true, - operators: OPERATOR_IS_ONLY, - options: [ - { value: 'enabled', title: 'Enabled' }, - { value: 'disabled', title: 'Disabled' }, - ], - requiredPermissions: 'canManageMembers', - }, - ]); + expect(findFilteredSearchBar().props('tokens')).toEqual([FILTERED_SEARCH_TOKEN_TWO_FACTOR]); }); describe('when `canManageMembers` is false', () => { @@ -93,7 +81,10 @@ describe('MembersFilteredSearchBar', () => { state: { filteredSearchBar: { show: true, - tokens: ['two_factor', 'with_inherited_permissions'], + tokens: [ + FILTERED_SEARCH_TOKEN_TWO_FACTOR.type, + FILTERED_SEARCH_TOKEN_WITH_INHERITED_PERMISSIONS.type, + ], searchParam: 'search', placeholder: 'Filter members', recentSearchesStorageKey: 'group_members', @@ -105,18 +96,7 @@ describe('MembersFilteredSearchBar', () => { }); expect(findFilteredSearchBar().props('tokens')).toEqual([ - { - type: 'with_inherited_permissions', - icon: 'group', - title: 'Membership', - token: GlFilteredSearchToken, - unique: true, - operators: OPERATOR_IS_ONLY, - options: [ - { value: 'exclude', title: 'Direct' }, - { value: 'only', title: 'Inherited' }, - ], - }, + FILTERED_SEARCH_TOKEN_WITH_INHERITED_PERMISSIONS, ]); }); }); @@ -134,7 +114,7 @@ describe('MembersFilteredSearchBar', () => { expect(findFilteredSearchBar().props('initialFilterValue')).toEqual([ { - type: 'two_factor', + type: FILTERED_SEARCH_TOKEN_TWO_FACTOR.type, value: { data: 'enabled', operator: '=', @@ -183,7 +163,7 @@ describe('MembersFilteredSearchBar', () => { createComponent(); findFilteredSearchBar().vm.$emit('onFilter', [ - { type: 'two_factor', value: { data: 'enabled', operator: '=' } }, + { type: FILTERED_SEARCH_TOKEN_TWO_FACTOR.type, value: { data: 'enabled', operator: '=' } }, ]); expect(redirectTo).toHaveBeenCalledWith('https://localhost/?two_factor=enabled'); @@ -193,7 +173,7 @@ describe('MembersFilteredSearchBar', () => { createComponent(); findFilteredSearchBar().vm.$emit('onFilter', [ - { type: 'two_factor', value: { data: 'enabled', operator: '=' } }, + { type: FILTERED_SEARCH_TOKEN_TWO_FACTOR.type, value: { data: 'enabled', operator: '=' } }, { type: 'filtered-search-term', value: { data: 'foobar' } }, ]); @@ -206,7 +186,7 @@ describe('MembersFilteredSearchBar', () => { createComponent(); findFilteredSearchBar().vm.$emit('onFilter', [ - { type: 'two_factor', value: { data: 'enabled', operator: '=' } }, + { type: FILTERED_SEARCH_TOKEN_TWO_FACTOR.type, value: { data: 'enabled', operator: '=' } }, { type: 'filtered-search-term', value: { data: 'foo bar baz' } }, ]); @@ -221,7 +201,7 @@ describe('MembersFilteredSearchBar', () => { createComponent(); findFilteredSearchBar().vm.$emit('onFilter', [ - { type: 'two_factor', value: { data: 'enabled', operator: '=' } }, + { type: FILTERED_SEARCH_TOKEN_TWO_FACTOR.type, value: { data: 'enabled', operator: '=' } }, { type: 'filtered-search-term', value: { data: 'foobar' } }, ]); |