diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/frontend/search/sidebar/components/status_filter_spec.js | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/frontend/search/sidebar/components/status_filter_spec.js')
-rw-r--r-- | spec/frontend/search/sidebar/components/status_filter_spec.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/spec/frontend/search/sidebar/components/status_filter_spec.js b/spec/frontend/search/sidebar/components/status_filter_spec.js new file mode 100644 index 00000000000..188d47b38cd --- /dev/null +++ b/spec/frontend/search/sidebar/components/status_filter_spec.js @@ -0,0 +1,65 @@ +import Vuex from 'vuex'; +import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { MOCK_QUERY } from 'jest/search/mock_data'; +import StatusFilter from '~/search/sidebar/components/status_filter.vue'; +import RadioFilter from '~/search/sidebar/components/radio_filter.vue'; + +const localVue = createLocalVue(); +localVue.use(Vuex); + +describe('StatusFilter', () => { + let wrapper; + + const actionSpies = { + applyQuery: jest.fn(), + resetQuery: jest.fn(), + }; + + const createComponent = initialState => { + const store = new Vuex.Store({ + state: { + query: MOCK_QUERY, + ...initialState, + }, + actions: actionSpies, + }); + + wrapper = shallowMount(StatusFilter, { + localVue, + store, + }); + }; + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + const findRadioFilter = () => wrapper.find(RadioFilter); + + describe('template', () => { + beforeEach(() => { + createComponent(); + }); + + describe.each` + scope | showFilter + ${'issues'} | ${true} + ${'merge_requests'} | ${true} + ${'projects'} | ${false} + ${'milestones'} | ${false} + ${'users'} | ${false} + ${'notes'} | ${false} + ${'wiki_blobs'} | ${false} + ${'blobs'} | ${false} + `(`dropdown`, ({ scope, showFilter }) => { + beforeEach(() => { + createComponent({ query: { scope } }); + }); + + it(`does${showFilter ? '' : ' not'} render when scope is ${scope}`, () => { + expect(findRadioFilter().exists()).toBe(showFilter); + }); + }); + }); +}); |