diff options
Diffstat (limited to 'spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js')
-rw-r--r-- | spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js | 26 |
1 files changed, 26 insertions, 0 deletions
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 af5434f7068..1bb9c429a2f 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 @@ -146,6 +146,21 @@ describe('MembersFilteredSearchBar', () => { }, ]); }); + + it('parses and passes search param with multiple words to `FilteredSearchBar` component as `initialFilterValue` prop', () => { + window.location.search = '?search=foo+bar+baz'; + + createComponent(); + + expect(findFilteredSearchBar().props('initialFilterValue')).toEqual([ + { + type: 'filtered-search-term', + value: { + data: 'foo bar baz', + }, + }, + ]); + }); }); describe('when filter bar is submitted', () => { @@ -175,6 +190,17 @@ describe('MembersFilteredSearchBar', () => { expect(window.location.href).toBe('https://localhost/?two_factor=enabled&search=foobar'); }); + it('adds search query param with multiple words', () => { + createComponent(); + + findFilteredSearchBar().vm.$emit('onFilter', [ + { type: 'two_factor', value: { data: 'enabled', operator: '=' } }, + { type: 'filtered-search-term', value: { data: 'foo bar baz' } }, + ]); + + expect(window.location.href).toBe('https://localhost/?two_factor=enabled&search=foo+bar+baz'); + }); + it('adds sort query param', () => { window.location.search = '?sort=name_asc'; |