Commit 16776549 authored by David O'Regan's avatar David O'Regan

Merge branch '292042-group-members-view-migrate-sorting-dropdown-to-glsorting' into 'master'

Switch to using GlSort for group members view

See merge request gitlab-org/gitlab!49527
parents a1b857c4 268ea6fb
<script> <script>
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import { GlDropdown, GlDropdownItem, GlFormGroup } from '@gitlab/ui'; import { GlSorting, GlSortingItem } from '@gitlab/ui';
import { parseSortParam, buildSortUrl } from '~/members/utils'; import { visitUrl } from '~/lib/utils/url_utility';
import { parseSortParam, buildSortHref } from '~/members/utils';
import { FIELDS } from '~/members/constants'; import { FIELDS } from '~/members/constants';
export default { export default {
name: 'SortDropdown', name: 'SortDropdown',
components: { GlDropdown, GlDropdownItem, GlFormGroup }, components: { GlSorting, GlSortingItem },
computed: { computed: {
...mapState(['tableSortableFields', 'filteredSearchBar']), ...mapState(['tableSortableFields', 'filteredSearchBar']),
sort() { sort() {
return parseSortParam(this.tableSortableFields); return parseSortParam(this.tableSortableFields);
}, },
activeOption() {
return FIELDS.find(field => field.key === this.sort.sortByKey);
},
activeOptionLabel() {
return this.activeOption?.label;
},
isAscending() {
return !this.sort.sortDesc;
},
filteredOptions() { filteredOptions() {
const buildOption = (field, sortDesc) => ({ return FIELDS.filter(field => this.tableSortableFields.includes(field.key) && field.sort).map(
...(sortDesc ? field.sort.desc : field.sort.asc), field => ({
key: field.key, key: field.key,
sortDesc, label: field.label,
url: buildSortUrl({ href: buildSortHref({
sortBy: field.key, sortBy: field.key,
sortDesc, sortDesc: false,
filteredSearchBarTokens: this.filteredSearchBar.tokens, filteredSearchBarTokens: this.filteredSearchBar.tokens,
filteredSearchBarSearchParam: this.filteredSearchBar.searchParam, filteredSearchBarSearchParam: this.filteredSearchBar.searchParam,
}),
}), }),
}); );
return FIELDS.filter(
field => this.tableSortableFields.includes(field.key) && field.sort,
).flatMap(field => [buildOption(field, false), buildOption(field, true)]);
}, },
}, },
methods: { methods: {
isChecked(key, sortDesc) { isActive(key) {
return this.sort?.sortBy === key && this.sort?.sortDesc === sortDesc; return this.activeOption.key === key;
},
handleSortDirectionChange() {
visitUrl(
buildSortHref({
sortBy: this.activeOption.key,
sortDesc: !this.sort.sortDesc,
filteredSearchBarTokens: this.filteredSearchBar.tokens,
filteredSearchBarSearchParam: this.filteredSearchBar.searchParam,
}),
);
}, },
}, },
}; };
</script> </script>
<template> <template>
<gl-form-group <gl-sorting
:label="__('Sort by')" class="gl-display-flex"
class="gl-mb-0" dropdown-class="gl-w-full"
label-cols="auto" data-testid="members-sort-dropdown"
label-class="gl-align-self-center gl-pb-0!" :text="activeOptionLabel"
:is-ascending="isAscending"
:sort-direction-tool-tip="__('Sort direction')"
@sortDirectionChange="handleSortDirectionChange"
> >
<gl-dropdown <gl-sorting-item
:text="sort.sortByLabel" v-for="option in filteredOptions"
block :key="option.key"
toggle-class="gl-mb-0" :href="option.href"
data-testid="members-sort-dropdown" :active="isActive(option.key)"
right
> >
<gl-dropdown-item {{ option.label }}
v-for="option in filteredOptions" </gl-sorting-item>
:key="option.param" </gl-sorting>
:href="option.url"
is-check-item
:is-checked="isChecked(option.key, option.sortDesc)"
>
{{ option.label }}
</gl-dropdown-item>
</gl-dropdown>
</gl-form-group>
</template> </template>
import { __, s__ } from '~/locale'; import { __ } from '~/locale';
const ACCOUNT_SORT_ASC_LABEL = s__('Members|Account, ascending');
export const FIELDS = [ export const FIELDS = [
{ {
key: 'account', key: 'account',
label: __('Account'), label: __('Account'),
sort: { sort: {
asc: { asc: 'name_asc',
param: 'name_asc', desc: 'name_desc',
label: ACCOUNT_SORT_ASC_LABEL,
},
desc: {
param: 'name_desc',
label: s__('Members|Account, descending'),
},
}, },
}, },
{ {
...@@ -29,14 +21,8 @@ export const FIELDS = [ ...@@ -29,14 +21,8 @@ export const FIELDS = [
thClass: 'col-meta', thClass: 'col-meta',
tdClass: 'col-meta', tdClass: 'col-meta',
sort: { sort: {
asc: { asc: 'last_joined',
param: 'last_joined', desc: 'oldest_joined',
label: s__('Members|Access granted, ascending'),
},
desc: {
param: 'oldest_joined',
label: s__('Members|Access granted, descending'),
},
}, },
}, },
{ {
...@@ -63,14 +49,8 @@ export const FIELDS = [ ...@@ -63,14 +49,8 @@ export const FIELDS = [
thClass: 'col-max-role', thClass: 'col-max-role',
tdClass: 'col-max-role', tdClass: 'col-max-role',
sort: { sort: {
asc: { asc: 'access_level_asc',
param: 'access_level_asc', desc: 'access_level_desc',
label: s__('Members|Max role, ascending'),
},
desc: {
param: 'access_level_desc',
label: s__('Members|Max role, descending'),
},
}, },
}, },
{ {
...@@ -81,15 +61,10 @@ export const FIELDS = [ ...@@ -81,15 +61,10 @@ export const FIELDS = [
}, },
{ {
key: 'lastSignIn', key: 'lastSignIn',
label: __('Last sign-in'),
sort: { sort: {
asc: { asc: 'recent_sign_in',
param: 'recent_sign_in', desc: 'oldest_sign_in',
label: s__('Members|Last sign-in, ascending'),
},
desc: {
param: 'oldest_sign_in',
label: s__('Members|Last sign-in, descending'),
},
}, },
}, },
{ {
...@@ -101,9 +76,8 @@ export const FIELDS = [ ...@@ -101,9 +76,8 @@ export const FIELDS = [
]; ];
export const DEFAULT_SORT = { export const DEFAULT_SORT = {
sortBy: 'account', sortByKey: 'account',
sortDesc: false, sortDesc: false,
sortByLabel: ACCOUNT_SORT_ASC_LABEL,
}; };
export const AVATAR_SIZE = 48; export const AVATAR_SIZE = 48;
......
...@@ -51,23 +51,20 @@ export const parseSortParam = sortableFields => { ...@@ -51,23 +51,20 @@ export const parseSortParam = sortableFields => {
const sortParam = getParameterByName('sort'); const sortParam = getParameterByName('sort');
const sortedField = FIELDS.filter(field => sortableFields.includes(field.key)).find( const sortedField = FIELDS.filter(field => sortableFields.includes(field.key)).find(
field => field.sort?.asc?.param === sortParam || field.sort?.desc?.param === sortParam, field => field.sort?.asc === sortParam || field.sort?.desc === sortParam,
); );
if (!sortedField) { if (!sortedField) {
return DEFAULT_SORT; return DEFAULT_SORT;
} }
const isDesc = sortedField?.sort?.desc?.param === sortParam;
return { return {
sortBy: sortedField.key, sortByKey: sortedField.key,
sortDesc: isDesc, sortDesc: sortedField?.sort?.desc === sortParam,
sortByLabel: isDesc ? sortedField?.sort?.desc?.label : sortedField?.sort?.asc?.label,
}; };
}; };
export const buildSortUrl = ({ export const buildSortHref = ({
sortBy, sortBy,
sortDesc, sortDesc,
filteredSearchBarTokens, filteredSearchBarTokens,
...@@ -79,7 +76,7 @@ export const buildSortUrl = ({ ...@@ -79,7 +76,7 @@ export const buildSortUrl = ({
return ''; return '';
} }
const sortParam = sortDesc ? sortDefinition.desc.param : sortDefinition.asc.param; const sortParam = sortDesc ? sortDefinition.desc : sortDefinition.asc;
const filterParams = const filterParams =
filteredSearchBarTokens?.reduce((accumulator, token) => { filteredSearchBarTokens?.reduce((accumulator, token) => {
......
...@@ -15995,6 +15995,9 @@ msgstr "" ...@@ -15995,6 +15995,9 @@ msgstr ""
msgid "Last seen" msgid "Last seen"
msgstr "" msgstr ""
msgid "Last sign-in"
msgstr ""
msgid "Last successful sync" msgid "Last successful sync"
msgstr "" msgstr ""
...@@ -16969,18 +16972,6 @@ msgstr "" ...@@ -16969,18 +16972,6 @@ msgstr ""
msgid "Members|2FA" msgid "Members|2FA"
msgstr "" msgstr ""
msgid "Members|Access granted, ascending"
msgstr ""
msgid "Members|Access granted, descending"
msgstr ""
msgid "Members|Account, ascending"
msgstr ""
msgid "Members|Account, descending"
msgstr ""
msgid "Members|An error occurred while trying to enable LDAP override, please try again." msgid "Members|An error occurred while trying to enable LDAP override, please try again."
msgstr "" msgstr ""
...@@ -17044,21 +17035,9 @@ msgstr "" ...@@ -17044,21 +17035,9 @@ msgstr ""
msgid "Members|LDAP override enabled." msgid "Members|LDAP override enabled."
msgstr "" msgstr ""
msgid "Members|Last sign-in, ascending"
msgstr ""
msgid "Members|Last sign-in, descending"
msgstr ""
msgid "Members|Leave \"%{source}\"" msgid "Members|Leave \"%{source}\""
msgstr "" msgstr ""
msgid "Members|Max role, ascending"
msgstr ""
msgid "Members|Max role, descending"
msgstr ""
msgid "Members|Membership" msgid "Members|Membership"
msgstr "" msgstr ""
......
...@@ -17,14 +17,20 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -17,14 +17,20 @@ RSpec.describe 'Groups > Members > Sort members', :js do
end end
context 'when `group_members_filtered_search` feature flag is enabled' do context 'when `group_members_filtered_search` feature flag is enabled' do
dropdown_toggle_selector = '[data-testid="members-sort-dropdown"] > button' def expect_sort_by(text, sort_direction)
within('[data-testid="members-sort-dropdown"]') do
expect(page).to have_css('button[aria-haspopup="true"]', text: text)
expect(page).to have_button("Sorting Direction: #{sort_direction == :asc ? 'Ascending' : 'Descending'}")
end
end
it 'sorts account by default' do it 'sorts by account by default' do
visit_members_list(sort: nil) visit_members_list(sort: nil)
expect(first_row.text).to include(owner.name) expect(first_row.text).to include(owner.name)
expect(second_row.text).to include(developer.name) expect(second_row.text).to include(developer.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Account, ascending')
expect_sort_by('Account', :asc)
end end
it 'sorts by max role ascending' do it 'sorts by max role ascending' do
...@@ -32,7 +38,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -32,7 +38,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do
expect(first_row.text).to include(developer.name) expect(first_row.text).to include(developer.name)
expect(second_row.text).to include(owner.name) expect(second_row.text).to include(owner.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Max role, ascending')
expect_sort_by('Max role', :asc)
end end
it 'sorts by max role descending' do it 'sorts by max role descending' do
...@@ -40,7 +47,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -40,7 +47,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do
expect(first_row.text).to include(owner.name) expect(first_row.text).to include(owner.name)
expect(second_row.text).to include(developer.name) expect(second_row.text).to include(developer.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Max role, descending')
expect_sort_by('Max role', :desc)
end end
it 'sorts by access granted ascending' do it 'sorts by access granted ascending' do
...@@ -48,7 +56,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -48,7 +56,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do
expect(first_row.text).to include(developer.name) expect(first_row.text).to include(developer.name)
expect(second_row.text).to include(owner.name) expect(second_row.text).to include(owner.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Access granted, ascending')
expect_sort_by('Access granted', :asc)
end end
it 'sorts by access granted descending' do it 'sorts by access granted descending' do
...@@ -56,7 +65,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -56,7 +65,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do
expect(first_row.text).to include(owner.name) expect(first_row.text).to include(owner.name)
expect(second_row.text).to include(developer.name) expect(second_row.text).to include(developer.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Access granted, descending')
expect_sort_by('Access granted', :desc)
end end
it 'sorts by account ascending' do it 'sorts by account ascending' do
...@@ -64,7 +74,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -64,7 +74,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do
expect(first_row.text).to include(owner.name) expect(first_row.text).to include(owner.name)
expect(second_row.text).to include(developer.name) expect(second_row.text).to include(developer.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Account, ascending')
expect_sort_by('Account', :asc)
end end
it 'sorts by account descending' do it 'sorts by account descending' do
...@@ -72,7 +83,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -72,7 +83,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do
expect(first_row.text).to include(developer.name) expect(first_row.text).to include(developer.name)
expect(second_row.text).to include(owner.name) expect(second_row.text).to include(owner.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Account, descending')
expect_sort_by('Account', :desc)
end end
it 'sorts by last sign-in ascending', :clean_gitlab_redis_shared_state do it 'sorts by last sign-in ascending', :clean_gitlab_redis_shared_state do
...@@ -80,7 +92,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -80,7 +92,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do
expect(first_row.text).to include(owner.name) expect(first_row.text).to include(owner.name)
expect(second_row.text).to include(developer.name) expect(second_row.text).to include(developer.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Last sign-in, ascending')
expect_sort_by('Last sign-in', :asc)
end end
it 'sorts by last sign-in descending', :clean_gitlab_redis_shared_state do it 'sorts by last sign-in descending', :clean_gitlab_redis_shared_state do
...@@ -88,7 +101,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do ...@@ -88,7 +101,8 @@ RSpec.describe 'Groups > Members > Sort members', :js do
expect(first_row.text).to include(developer.name) expect(first_row.text).to include(developer.name)
expect(second_row.text).to include(owner.name) expect(second_row.text).to include(owner.name)
expect(page).to have_css(dropdown_toggle_selector, text: 'Last sign-in, descending')
expect_sort_by('Last sign-in', :desc)
end end
end end
......
import { mount, createLocalVue } from '@vue/test-utils'; import { mount, createLocalVue } from '@vue/test-utils';
import { within } from '@testing-library/dom';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { GlDropdownItem } from '@gitlab/ui'; import { GlSorting, GlSortingItem } from '@gitlab/ui';
import SortDropdown from '~/members/components/filter_sort/sort_dropdown.vue'; import SortDropdown from '~/members/components/filter_sort/sort_dropdown.vue';
import * as urlUtilities from '~/lib/utils/url_utility';
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
...@@ -34,10 +34,13 @@ describe('SortDropdown', () => { ...@@ -34,10 +34,13 @@ describe('SortDropdown', () => {
}); });
}; };
const findSortingComponent = () => wrapper.find(GlSorting);
const findSortDirectionToggle = () =>
findSortingComponent().find('button[title="Sort direction"]');
const findDropdownToggle = () => wrapper.find('button[aria-haspopup="true"]'); const findDropdownToggle = () => wrapper.find('button[aria-haspopup="true"]');
const findDropdownItemByText = text => const findDropdownItemByText = text =>
wrapper wrapper
.findAll(GlDropdownItem) .findAll(GlSortingItem)
.wrappers.find(dropdownItemWrapper => dropdownItemWrapper.text() === text); .wrappers.find(dropdownItemWrapper => dropdownItemWrapper.text() === text);
describe('dropdown options', () => { describe('dropdown options', () => {
...@@ -54,37 +57,21 @@ describe('SortDropdown', () => { ...@@ -54,37 +57,21 @@ describe('SortDropdown', () => {
const expectedDropdownItems = [ const expectedDropdownItems = [
{ {
label: 'Account, ascending', label: 'Account',
url: `${EXPECTED_BASE_URL}name_asc`, url: `${EXPECTED_BASE_URL}name_asc`,
}, },
{ {
label: 'Account, descending', label: 'Access granted',
url: `${EXPECTED_BASE_URL}name_desc`,
},
{
label: 'Access granted, ascending',
url: `${EXPECTED_BASE_URL}last_joined`, url: `${EXPECTED_BASE_URL}last_joined`,
}, },
{ {
label: 'Access granted, descending', label: 'Max role',
url: `${EXPECTED_BASE_URL}oldest_joined`,
},
{
label: 'Max role, ascending',
url: `${EXPECTED_BASE_URL}access_level_asc`, url: `${EXPECTED_BASE_URL}access_level_asc`,
}, },
{ {
label: 'Max role, descending', label: 'Last sign-in',
url: `${EXPECTED_BASE_URL}access_level_desc`,
},
{
label: 'Last sign-in, ascending',
url: `${EXPECTED_BASE_URL}recent_sign_in`, url: `${EXPECTED_BASE_URL}recent_sign_in`,
}, },
{
label: 'Last sign-in, descending',
url: `${EXPECTED_BASE_URL}oldest_sign_in`,
},
]; ];
createComponent(); createComponent();
...@@ -102,7 +89,7 @@ describe('SortDropdown', () => { ...@@ -102,7 +89,7 @@ describe('SortDropdown', () => {
createComponent(); createComponent();
expect(findDropdownItemByText('Max role, ascending').props('isChecked')).toBe(true); expect(findDropdownItemByText('Max role').vm.$attrs.active).toBe(true);
}); });
}); });
...@@ -112,10 +99,11 @@ describe('SortDropdown', () => { ...@@ -112,10 +99,11 @@ describe('SortDropdown', () => {
window.location = new URL(URL_HOST); window.location = new URL(URL_HOST);
}); });
it('defaults to sorting by "Account, ascending"', () => { it('defaults to sorting by "Account" in ascending order', () => {
createComponent(); createComponent();
expect(findDropdownToggle().text()).toBe('Account, ascending'); expect(findSortingComponent().props('isAscending')).toBe(true);
expect(findDropdownToggle().text()).toBe('Account');
}); });
it('sets text as selected sort option', () => { it('sets text as selected sort option', () => {
...@@ -123,13 +111,52 @@ describe('SortDropdown', () => { ...@@ -123,13 +111,52 @@ describe('SortDropdown', () => {
createComponent(); createComponent();
expect(findDropdownToggle().text()).toBe('Max role, ascending'); expect(findDropdownToggle().text()).toBe('Max role');
}); });
}); });
it('renders dropdown label', () => { describe('sort direction toggle', () => {
createComponent(); beforeEach(() => {
delete window.location;
window.location = new URL(URL_HOST);
jest.spyOn(urlUtilities, 'visitUrl');
});
describe('when current sort direction is ascending', () => {
beforeEach(() => {
window.location.search = '?sort=access_level_asc';
createComponent();
});
describe('when sort direction toggle is clicked', () => {
beforeEach(() => {
findSortDirectionToggle().trigger('click');
});
it('sorts in descending order', () => {
expect(urlUtilities.visitUrl).toHaveBeenCalledWith(`${URL_HOST}?sort=access_level_desc`);
});
});
});
expect(within(wrapper.element).queryByText('Sort by')).not.toBe(null); describe('when current sort direction is descending', () => {
beforeEach(() => {
window.location.search = '?sort=access_level_desc';
createComponent();
});
describe('when sort direction toggle is clicked', () => {
beforeEach(() => {
findSortDirectionToggle().trigger('click');
});
it('sorts in ascending order', () => {
expect(urlUtilities.visitUrl).toHaveBeenCalledWith(`${URL_HOST}?sort=access_level_asc`);
});
});
});
}); });
}); });
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
canUpdate, canUpdate,
canOverride, canOverride,
parseSortParam, parseSortParam,
buildSortUrl, buildSortHref,
} from '~/members/utils'; } from '~/members/utils';
import { DEFAULT_SORT } from '~/members/constants'; import { DEFAULT_SORT } from '~/members/constants';
import { member as memberMock, group, invite } from './mock_data'; import { member as memberMock, group, invite } from './mock_data';
...@@ -148,14 +148,14 @@ describe('Members Utils', () => { ...@@ -148,14 +148,14 @@ describe('Members Utils', () => {
describe.each` describe.each`
sortParam | expected sortParam | expected
${'name_asc'} | ${{ sortBy: 'account', sortDesc: false, sortByLabel: 'Account, ascending' }} ${'name_asc'} | ${{ sortByKey: 'account', sortDesc: false }}
${'name_desc'} | ${{ sortBy: 'account', sortDesc: true, sortByLabel: 'Account, descending' }} ${'name_desc'} | ${{ sortByKey: 'account', sortDesc: true }}
${'last_joined'} | ${{ sortBy: 'granted', sortDesc: false, sortByLabel: 'Access granted, ascending' }} ${'last_joined'} | ${{ sortByKey: 'granted', sortDesc: false }}
${'oldest_joined'} | ${{ sortBy: 'granted', sortDesc: true, sortByLabel: 'Access granted, descending' }} ${'oldest_joined'} | ${{ sortByKey: 'granted', sortDesc: true }}
${'access_level_asc'} | ${{ sortBy: 'maxRole', sortDesc: false, sortByLabel: 'Max role, ascending' }} ${'access_level_asc'} | ${{ sortByKey: 'maxRole', sortDesc: false }}
${'access_level_desc'} | ${{ sortBy: 'maxRole', sortDesc: true, sortByLabel: 'Max role, descending' }} ${'access_level_desc'} | ${{ sortByKey: 'maxRole', sortDesc: true }}
${'recent_sign_in'} | ${{ sortBy: 'lastSignIn', sortDesc: false, sortByLabel: 'Last sign-in, ascending' }} ${'recent_sign_in'} | ${{ sortByKey: 'lastSignIn', sortDesc: false }}
${'oldest_sign_in'} | ${{ sortBy: 'lastSignIn', sortDesc: true, sortByLabel: 'Last sign-in, descending' }} ${'oldest_sign_in'} | ${{ sortByKey: 'lastSignIn', sortDesc: true }}
`('when `sort` query string param is `$sortParam`', ({ sortParam, expected }) => { `('when `sort` query string param is `$sortParam`', ({ sortParam, expected }) => {
it(`returns ${JSON.stringify(expected)}`, async () => { it(`returns ${JSON.stringify(expected)}`, async () => {
window.location.search = `?sort=${sortParam}`; window.location.search = `?sort=${sortParam}`;
...@@ -167,7 +167,7 @@ describe('Members Utils', () => { ...@@ -167,7 +167,7 @@ describe('Members Utils', () => {
}); });
}); });
describe('buildSortUrl', () => { describe('buildSortHref', () => {
beforeEach(() => { beforeEach(() => {
delete window.location; delete window.location;
window.location = new URL(URL_HOST); window.location = new URL(URL_HOST);
...@@ -176,7 +176,7 @@ describe('Members Utils', () => { ...@@ -176,7 +176,7 @@ describe('Members Utils', () => {
describe('when field passed in `sortBy` argument does not have `sort` key defined', () => { describe('when field passed in `sortBy` argument does not have `sort` key defined', () => {
it('returns an empty string', () => { it('returns an empty string', () => {
expect( expect(
buildSortUrl({ buildSortHref({
sortBy: 'source', sortBy: 'source',
sortDesc: false, sortDesc: false,
filteredSearchBarTokens: [], filteredSearchBarTokens: [],
...@@ -189,7 +189,7 @@ describe('Members Utils', () => { ...@@ -189,7 +189,7 @@ describe('Members Utils', () => {
describe('when there are no filter params set', () => { describe('when there are no filter params set', () => {
it('sets `sort` param', () => { it('sets `sort` param', () => {
expect( expect(
buildSortUrl({ buildSortHref({
sortBy: 'account', sortBy: 'account',
sortDesc: false, sortDesc: false,
filteredSearchBarTokens: [], filteredSearchBarTokens: [],
...@@ -204,7 +204,7 @@ describe('Members Utils', () => { ...@@ -204,7 +204,7 @@ describe('Members Utils', () => {
window.location.search = '?two_factor=enabled&with_inherited_permissions=exclude'; window.location.search = '?two_factor=enabled&with_inherited_permissions=exclude';
expect( expect(
buildSortUrl({ buildSortHref({
sortBy: 'account', sortBy: 'account',
sortDesc: false, sortDesc: false,
filteredSearchBarTokens: ['two_factor', 'with_inherited_permissions'], filteredSearchBarTokens: ['two_factor', 'with_inherited_permissions'],
...@@ -219,7 +219,7 @@ describe('Members Utils', () => { ...@@ -219,7 +219,7 @@ describe('Members Utils', () => {
window.location.search = '?search=foobar'; window.location.search = '?search=foobar';
expect( expect(
buildSortUrl({ buildSortHref({
sortBy: 'account', sortBy: 'account',
sortDesc: false, sortDesc: false,
filteredSearchBarTokens: ['two_factor', 'with_inherited_permissions'], filteredSearchBarTokens: ['two_factor', 'with_inherited_permissions'],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment