Commit 1c55f731 authored by Scott Stern's avatar Scott Stern Committed by Olena Horal-Koretska

Add logic to support search for epic boards

parent 1a6622c5
...@@ -3,6 +3,7 @@ import { pickBy } from 'lodash'; ...@@ -3,6 +3,7 @@ import { pickBy } from 'lodash';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { updateHistory, setUrlParams } from '~/lib/utils/url_utility'; import { updateHistory, setUrlParams } from '~/lib/utils/url_utility';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { FILTERED_SEARCH_TERM } from '~/vue_shared/components/filtered_search_bar/constants';
import FilteredSearch from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearch from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
export default { export default {
...@@ -104,7 +105,9 @@ export default { ...@@ -104,7 +105,9 @@ export default {
}, },
getFilterParams(filters = []) { getFilterParams(filters = []) {
const notFilters = filters.filter((item) => item.value.operator === '!='); const notFilters = filters.filter((item) => item.value.operator === '!=');
const equalsFilters = filters.filter((item) => item.value.operator === '='); const equalsFilters = filters.filter(
(item) => item?.value?.operator === '=' || item.type === FILTERED_SEARCH_TERM,
);
return { ...this.generateParams(equalsFilters), not: { ...this.generateParams(notFilters) } }; return { ...this.generateParams(equalsFilters), not: { ...this.generateParams(notFilters) } };
}, },
......
...@@ -287,6 +287,20 @@ RSpec.describe 'epic boards', :js do ...@@ -287,6 +287,20 @@ RSpec.describe 'epic boards', :js do
expect(page).to have_content('Epic2') expect(page).to have_content('Epic2')
expect(page).to have_content('Epic3') expect(page).to have_content('Epic3')
end end
it 'can search for an epic in the search bar' do
fill_in 'Search', with: 'Epic 1'
page.within('[data-testid="epic-filtered-search"]') do
find('input').native.send_keys(:return)
end
wait_for_requests
expect(page).to have_content('Epic1')
expect(page).not_to have_content('Epic2')
expect(page).not_to have_content('Epic3')
end
end end
def visit_epic_boards_page def visit_epic_boards_page
......
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