diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-03 18:10:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-03 18:10:59 +0300 |
commit | 2f08c2b7d2cd32d0791986958d3242673ff037a9 (patch) | |
tree | 7424040bd1bfaf5455fb7e21dd4a25a5b513dc6b /spec/frontend/search/sidebar | |
parent | d9ec4caf8fe4a4315e8e09e48d3ec79fd0a724c5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/search/sidebar')
-rw-r--r-- | spec/frontend/search/sidebar/components/archived_filter_spec.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/frontend/search/sidebar/components/archived_filter_spec.js b/spec/frontend/search/sidebar/components/archived_filter_spec.js index 69bf2ebd72e..a4c1f3b758f 100644 --- a/spec/frontend/search/sidebar/components/archived_filter_spec.js +++ b/spec/frontend/search/sidebar/components/archived_filter_spec.js @@ -12,9 +12,14 @@ Vue.use(Vuex); describe('ArchivedFilter', () => { let wrapper; + const defaultActions = { + setQuery: jest.fn(), + }; + const createComponent = (state) => { const store = new Vuex.Store({ state, + actions: defaultActions, }); wrapper = shallowMount(ArchivedFilter, { @@ -70,4 +75,20 @@ describe('ArchivedFilter', () => { expect(findCheckboxFilter().attributes('checked')).toBe(checkboxState); }); }); + + describe('selectedFilter logic', () => { + beforeEach(() => { + createComponent(); + }); + + it('correctly executes setQuery without mutating the input', () => { + const selectedFilter = [false]; + findCheckboxFilter().vm.$emit('input', selectedFilter); + expect(defaultActions.setQuery).toHaveBeenCalledWith(expect.any(Object), { + key: 'include_archived', + value: 'false', + }); + expect(selectedFilter).toEqual([false]); + }); + }); }); |