diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-03 21:13:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-03 21:13:40 +0300 |
commit | bbc36645d34c557df40d031a1a41fbd05e491644 (patch) | |
tree | 55529c6e93d72f7e35e78488a397f50098f137a5 /spec/frontend/boards/components | |
parent | 70a50740a20ab0027e0490487f6244f5ec961eee (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards/components')
-rw-r--r-- | spec/frontend/boards/components/board_filtered_search_spec.js | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/spec/frontend/boards/components/board_filtered_search_spec.js b/spec/frontend/boards/components/board_filtered_search_spec.js index dc93890f27a..b858d6e95a0 100644 --- a/spec/frontend/boards/components/board_filtered_search_spec.js +++ b/spec/frontend/boards/components/board_filtered_search_spec.js @@ -7,6 +7,7 @@ import { __ } from '~/locale'; import FilteredSearchBarRoot from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; +import { createStore } from '~/boards/stores'; Vue.use(Vuex); @@ -42,17 +43,13 @@ describe('BoardFilteredSearch', () => { }, ]; - const createComponent = ({ initialFilterParams = {} } = {}) => { - store = new Vuex.Store({ - actions: { - performSearch: jest.fn(), - }, - }); - + const createComponent = ({ initialFilterParams = {}, props = {} } = {}) => { + store = createStore(); wrapper = shallowMount(BoardFilteredSearch, { provide: { initialFilterParams, fullPath: '' }, store, propsData: { + ...props, tokens, }, }); @@ -68,11 +65,7 @@ describe('BoardFilteredSearch', () => { beforeEach(() => { createComponent(); - jest.spyOn(store, 'dispatch'); - }); - - it('renders FilteredSearch', () => { - expect(findFilteredSearch().exists()).toBe(true); + jest.spyOn(store, 'dispatch').mockImplementation(); }); it('passes the correct tokens to FilteredSearch', () => { @@ -99,6 +92,22 @@ describe('BoardFilteredSearch', () => { }); }); + describe('when eeFilters is not empty', () => { + it('passes the correct initialFilterValue to FitleredSearchBarRoot', () => { + createComponent({ props: { eeFilters: { labelName: ['label'] } } }); + + expect(findFilteredSearch().props('initialFilterValue')).toEqual([ + { type: 'label_name', value: { data: 'label', operator: '=' } }, + ]); + }); + }); + + it('renders FilteredSearch', () => { + createComponent(); + + expect(findFilteredSearch().exists()).toBe(true); + }); + describe('when searching', () => { beforeEach(() => { createComponent(); |