diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /spec/frontend/search/sidebar/components/confidentiality_filter_spec.js | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'spec/frontend/search/sidebar/components/confidentiality_filter_spec.js')
-rw-r--r-- | spec/frontend/search/sidebar/components/confidentiality_filter_spec.js | 63 |
1 files changed, 22 insertions, 41 deletions
diff --git a/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js b/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js index c57eabd57b9..d5ecca4636c 100644 --- a/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js +++ b/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js @@ -1,39 +1,16 @@ import { shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; -import Vuex from 'vuex'; -import { MOCK_QUERY } from 'jest/search/mock_data'; import ConfidentialityFilter from '~/search/sidebar/components/confidentiality_filter.vue'; import RadioFilter from '~/search/sidebar/components/radio_filter.vue'; -Vue.use(Vuex); - describe('ConfidentialityFilter', () => { 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, - }); - + const createComponent = (initProps) => { wrapper = shallowMount(ConfidentialityFilter, { - store, + ...initProps, }); }; - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - const findRadioFilter = () => wrapper.findComponent(RadioFilter); describe('template', () => { @@ -41,24 +18,28 @@ describe('ConfidentialityFilter', () => { createComponent(); }); - describe.each` - scope | showFilter - ${'issues'} | ${true} - ${'merge_requests'} | ${false} - ${'projects'} | ${false} - ${'milestones'} | ${false} - ${'users'} | ${false} - ${'notes'} | ${false} - ${'wiki_blobs'} | ${false} - ${'blobs'} | ${false} - `(`dropdown`, ({ scope, showFilter }) => { - beforeEach(() => { - createComponent({ query: { scope } }); - }); + it('renders the component', () => { + expect(findRadioFilter().exists()).toBe(true); + }); + }); - it(`does${showFilter ? '' : ' not'} render when scope is ${scope}`, () => { - expect(findRadioFilter().exists()).toBe(showFilter); + describe.each` + hasFeatureFlagEnabled | paddingClass + ${true} | ${'gl-px-5'} + ${false} | ${'gl-px-0'} + `(`RadioFilter`, ({ hasFeatureFlagEnabled, paddingClass }) => { + beforeEach(() => { + createComponent({ + provide: { + glFeatures: { + searchPageVerticalNav: hasFeatureFlagEnabled, + }, + }, }); }); + + it(`has ${paddingClass} class`, () => { + expect(findRadioFilter().classes(paddingClass)).toBe(true); + }); }); }); |